Connection drops after 2 hours #341
-
I have a script as below. After a certain time (like 2 hours), the code does not work when the database is changed. It doesn't disconnect with WiFi: I tested it. No issues with power either. How can I solve this problem or how can I write a function to signal when the connection to Firebase is lost? #include <Arduino.h> // Provide the token generation process info. // Insert your network credentials // Insert Firebase project API Key // Insert Authorized Username and Corresponding Password // Insert RTDB URLefine the RTDB URL // Define Firebase objects // Variables to save database paths // Declare outputs // Initialize WiFi // Callback function that runs on database changes // Get the path that triggered the function // if the data returned is an integer, there was a change on the GPIO state on the following path /{gpio_number} /* When it first runs, it is triggered on the root (/) path and returns a JSON with all keys
} //This is the size of stream payload received (current and max value) void streamTimeoutCallback(bool timeout){ void setup(){ // Initialize Outputs // Assign the api key (required) // Assign the user sign in credentials // Assign the RTDB URL (required) Firebase.reconnectWiFi(true); // Assign the callback function for the long running token generation task */ // Assign the maximum retry of token generation // Initialize the library with the Firebase authen and config // Streaming (whenever data changes on a path) // Assign a calback function to run when it detects changes on the database delay(2000); void loop(){ } |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should follow the example and read all comments in examples. Firebase-ESP8266/examples/Basic/Basic.ino Lines 134 to 139 in f20f0b6 |
Beta Was this translation helpful? Give feedback.
You should follow the example and read all comments in examples.
Firebase-ESP8266/examples/Basic/Basic.ino
Lines 134 to 139 in f20f0b6