Reconnection and device conflict
Automatic reconnection
The SDK has a built-in automatic reconnection mechanism. Once the initial connection succeeds, the SDK takes over all reconnection handling. When the connection drops due to network issues, the SDK automatically attempts to reconnect without any action on your part.
The SDK maintains a heartbeat with the server. If the heartbeat times out (for example, due to poor or absent network connectivity), the SDK triggers the reconnection process and keeps retrying until the connection is restored.
If a connection error callback fires, the SDK exits the reconnection loop. Handle the specific status code in your application logic.
Reconnection interval
The SDK retries the connection every 5 seconds.
Exiting the reconnection loop
When you explicitly call disconnect, the SDK exits the reconnection mechanism and does not attempt further reconnection.
Multi-device conflict (kick)
If the same user connects from another device (and the app's multi-device policy does not allow concurrent sessions), the SDK receives a KICKED_OFFLINE_BY_OTHER_CLIENT status. In this case:
- The current session is terminated.
- The SDK does not attempt to reconnect.
- Your app should prompt the user and redirect to the login screen.