ConnectionStateType

Network connection state.

Enumerations

connectionStateDisconnected
1: Disconnected from the network. This state indicates the SDK is:
connectionStateConnecting
2: Connecting to the network. This state indicates the SDK is establishing a connection to the specified channel after calling joinChannel.
  • If the channel is joined successfully, the app receives the onConnectionStateChanged callback indicating the network state has changed to connectionStateConnected.
  • After establishing the connection, the SDK initializes media and calls back onJoinChannelSuccess when everything is ready.
connectionStateConnected
3: Network connected. This state indicates the user has joined the channel and can publish or subscribe to media streams. If the connection to the channel is lost due to network issues or switching, the SDK attempts to reconnect. The app receives the onConnectionStateChanged callback indicating the network state has changed to connectionStateReconnecting.
connectionStateReconnecting
4: Reconnecting to the network. This state indicates the SDK had previously joined the channel but the connection was interrupted due to network issues. The SDK automatically attempts to rejoin the channel.
  • If the SDK fails to rejoin within 10 seconds, onConnectionLost is triggered. The SDK remains in the connectionStateReconnecting state and continues trying to rejoin.
  • If the SDK fails to rejoin the channel within 20 minutes after disconnection, the app receives the onConnectionStateChanged callback indicating the network state has changed to connectionStateFailed, and the SDK stops trying to reconnect.
connectionStateFailed
5: Network connection failed. This state indicates the SDK has stopped trying to rejoin the channel and you need to call leaveChannel to leave.
  • If the user wants to rejoin the channel, call joinChannel again.
  • If the SDK is forbidden to join the channel due to the server using RESTful API, the app receives onConnectionStateChanged.