Closed pranjul-arctano closed 1 year ago
You should ask this such question by posting in discussions topics instead.
Do not touch the stream time out setting as it works properly with Firebase REST API even it can be changed.
Normally stream time out period is 45 seconds, and you should not get the stream timed out error unless, the internet connection was interrupted or unstable. In case internet connection problems, you may get the stream timed out error in several seconds and more often in case WiFi or network disconnected.
But I want stream timeout callback instantly whenever internet is not their and the callback has to be called after every 1 sec if the device has no internet access.
You should use other method to test internet connection e.g. pinging or search Google for how to.
This library is Firebase client library using REST API.
ok thanks
It's not possible to detect the server connection status after client connected in Server-Sent Events http (stream) method.
It's different from web socket or other protocols e.g., MQTT, in stream, client waits for server sent event data (one way messaging) especially keep-alive event to determine that server was still alive.
If no keep-alive event data sent from server within the specific period, the server connection may be lost, and we need to close the connection to clear resource and start a new connection.
Please learn more about Server-Sent Events API.
FYI. The device disconnected event is only available in Firebase client that runs on device that Firebase SDK was installed as it uses web socket.
Can anyone tell me how to set the stream timeout time, In my case I am getting timeout callback after every 15 seconds for few minutes when internet is not available, and after few minutes the callback comes after every 3 seconds. Is their any direct function to set it??