Describe the bug
I am using Callback example without writing any data in the loop.
After 1 hour there is no response from the module when I change the database values.
To Reproduce
Steps to reproduce the behavior:
Load Callback example
Comment out all the code in loop function
After an hour, not getting any stream data anymore.
Expected behavior
Is it possible to have the read only connection alive forever?
Versions:
Arduino IDE 1.8.19
Firebase-ESP32 3.14.5
void streamCallback(StreamData data)
{
Serial.printf("sream path, %s\nevent path, %s\ndata type, %s\nevent type, %s\n\n",
data.streamPath().c_str(),
data.dataPath().c_str(),
data.dataType().c_str(),
data.eventType().c_str());
printResult(data); //see addons/RTDBHelper.h
Serial.println();
Serial.printf("Received stream payload size: %d (Max. %d)\n\n", data.payloadLength(), data.maxPayloadLength());
}
void streamTimeoutCallback(bool timeout)
{
if (timeout)
Serial.println("stream timed out, resuming...\n");
if (!stream.httpConnected())
Serial.printf("error code: %d, reason: %s\n\n", stream.httpCode(), stream.errorReason().c_str());
}
void setup()
{
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);
/* Assign the api key (required) */
config.api_key = API_KEY;
/* Assign the user sign in credentials */
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
/* Assign the RTDB URL (required) */
config.database_url = DATABASE_URL;
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
//Recommend for ESP8266 stream, adjust the buffer size to match your stream data size
#if defined(ESP8266)
stream.setBSSLBufferSize(2048 /* Rx in bytes, 512 - 16384 */, 512 /* Tx in bytes, 512 - 16384 */);
#endif
// if (!Firebase.beginStream(stream, "/test/stream/data"))
if (!Firebase.beginStream(stream, "/eew/13"))
Serial.printf("sream begin error, %s\n\n", stream.errorReason().c_str());
Firebase.setStreamCallback(stream, streamCallback, streamTimeoutCallback);
}
void loop()
{
}
Describe the bug I am using Callback example without writing any data in the loop. After 1 hour there is no response from the module when I change the database values.
To Reproduce Steps to reproduce the behavior:
Expected behavior Is it possible to have the read only connection alive forever?
Versions: