Network Connection Status

This section describes using Hummer SDK to determine server connection status.

1. Callback of Server Network Connection Status

Statuses for connection to the server network are as depicted below:

Get the changes of connection status with the server via the callback onUpdateChannelState:

  • Disconnected: Channel is disconnected;
  • Connecting: Channel is connecting;
  • Connected: The channel is connected.

The operations for SDK triggering the onUpdateChannelState are as follows:

  1. After the SDK method init is successfully called, the connections status notified by the callback changes from Disconnected to Connecting.
  1. After the SDK method open is successfully called, the connections status notified by the callback changes from Connecing to Connected.
  1. After disconnection from the server is detected, the SDK notifies the connection status as Disconnected in the callback.

2. Reconnection Following Server Network Disconnection

You can communicate with background developers to set the maximum elapsed time between disconnection and reconnection. Once connection is established between the SDK and the server, your device disconnecting and reconnecting to the network will generate one of these two results:

  • Your device will restore connection to the network within the specified time period. The SDK will reconnect to the server and trigger callback onUpdateChannelState , for which connection status will change from Disconnected to Connecting. After successful connection with the server, status will change again from Connecting to Connected.

  • Device network reconnection times out, and the SDK will no longer connect to the server.

3. API Reference

4. Notices

<