ConnectionStateType

Network connection state.

Enumerations

ConnectionStateDisconnected
1: Disconnected from the network. This state indicates that the SDK is:
ConnectionStateConnecting
2: Connecting to the network. This state indicates that 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 the connection is established, the SDK initializes media and triggers the onJoinChannelSuccess callback when ready.
ConnectionStateConnected
3: Connected to the network. This state indicates that the user has joined the channel and can publish or subscribe to media streams. If the connection is interrupted due to network issues or switching, the SDK automatically reconnects. The app receives the onConnectionStateChanged callback indicating the network state has changed to ConnectionStateReconnecting.
ConnectionStateReconnecting
4: Reconnecting to the network. This state indicates that the SDK was previously connected to the channel but the connection was interrupted due to network issues. The SDK is now trying to reconnect to the channel.
  • If the SDK fails to rejoin the channel 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 that the SDK has stopped trying to rejoin the channel. You need to call leaveChannel to leave the channel.
  • If the user wants to rejoin the channel, call joinChannel again.
  • If the SDK is banned from joining the channel by the server using RESTful API, the app receives the onConnectionStateChanged callback.