mobizt / Firebase-ESP32

[DEPRECATED]🔥 Firebase RTDB Arduino Library for ESP32. The complete, fast, secured and reliable Firebase Arduino client library that supports CRUD (create, read, update, delete) and Stream operations.
MIT License
413 stars 119 forks source link

Firebase pause and restart #165

Closed am-canes closed 3 years ago

am-canes commented 3 years ago

Hello,

I am using two firebase objects, one for stream and other for update data. I am doing a Ping to detect if the internet connection is good. And when I detect a bad connection I use the function pauseFirebase to pause. And I restart just when connection is good again. But sometimes, after a while, firebase stops to receive the stream and to update. I think that maybe it is not restarting for some reason. What is the return of pauseFirebase? Could I use the result to know if firebase restarted? Is there any other way to know if it is connected? And if it is not connected, is there any way to restart?

I just try to update when wifi is connected and the connection is good.

mobizt commented 3 years ago

No extra ping or stop/start is necessary, just call httpConnected() from Firebase Data object which gives the precise status of server connection.

The stream resuming is done appropriately when timed out (heart beat data or keep-alive event data from server was missed more than 40 seconds).

Please don't use pauseFirebase for stream Firebase Data object and let the internal flow operate normally.

mobizt commented 3 years ago

The internet connection will be managed (resume) internally as you call Firebase.reconnectWiFi(true);.

Do not use reconnectWiFi(true) with the WiFiManager or code that also handles the WiFi reconnection because it will interfere to each other.