Closed palpeter95 closed 3 years ago
The method httpConnected returns the status of internal http client that connected to server.
In stream connection, this method returns true as long as the stream connected and returns false as stream connection is timeout.
In the none stream connection from the store, restore and update functions, the method httpConnected returns true as long as last connection to server is established and WiFi is connected this because it stays connect (keep-alive connection) to reuse the connection in the later calls which will minimize the time used in data transmission as the client does not need to perform the time consuming process of SSL handshake again (almost 1 second used for SSL handshake).
In the above cases, the httpConnected will reset to false when WiFi disconnected and the http client will release the resources it used. If there are no Firebase calls i.e. get, set, update, the method httpConnected will return false as no http connection established.
Then return of httpConnected is not the WiFi or internet connection status unless the status of last http connection between client and server.
The httpConnected will return to true in stream connection if the WiFi connected and internet connection is available.
Then don't use it for your internet connection checking.
I have experienced an interesting thing:
Normally, I connect with my ESP32 to my WiFi that is shared from my router, however in some rare cases there is a problem with my ISP. In this particular case, the router works well and my device is still connected to the WiFi, also the
WiFi.status() == WL_CONNECTED
is true, but obivously there is no real internet connection because of the ISP.I send some data to Firebase in every hour and I could also detect this bug with the
firebaseData.httpConnected()
method. In this case it returns false.Once the error on the ISP side is solved and the internet connection comes back, the
httpConnected()
method still returns false.Could you please advise something about this?
PS.: In the
setup()
method I use theFirebase.reconnectWiFi(true);
, but this doesn't change on the end result, sinceWiFi.status() == WL_CONNECTED.
is always true in this scenario.