CONNECTION_STATE_TYPE
Connection states.
Enumerator
- CONNECTION_STATE_DISCONNECTED
-
1: The SDK is disconnected from the Agora edge server. The state indicates the SDK is in one of the following phases:
- Theinitial state before calling the joinChannel [2/2] method.
- The app calls the leaveChannel [1/2] method.
- CONNECTION_STATE_CONNECTING
-
2: The SDK is connecting to the Agora edge server. This state indicates that the SDK is establishing a connection with the specified channel after the app calls joinChannel [2/2].
- If the SDK successfully joins the channel, it triggers the onConnectionStateChanged callback and the connection state switches to CONNECTION_STATE_CONNECTED.
- After the connection is established, the SDK also initializes the media and triggers onJoinChannelSuccess when everything is ready.
- CONNECTION_STATE_CONNECTED
- 3: The SDK is connected to the Agora edge server. This state also indicates that the user has joined a channel and can now publish or subscribe to a media stream in the channel. If the connection to the channel is lost because, for example, if the network is down or switched, the SDK automatically tries to reconnect and triggers onConnectionStateChanged callback, notifying that the current network state becomes CONNECTION_STATE_RECONNECTING.
- CONNECTION_STATE_RECONNECTING
-
4: The SDK keeps reconnecting to the Agora edge server. The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues.
- If the SDK cannot rejoin the channel within 10 seconds, it triggers onConnectionLost, stays in the CONNECTION_STATE_RECONNECTING state, and keeps rejoining the channel.
- If the SDK fails to rejoin the channel 20 minutes after being disconnected from the Agora edge server, the SDK triggers the onConnectionStateChanged callback, switches to the CONNECTION_STATE_FAILED state, and stops rejoining the channel.
- CONNECTION_STATE_FAILED
-
5: The SDK fails to connect to the Agora edge server or join the channel. This state indicates that the SDK stops trying to rejoin the channel. You must call leaveChannel [1/2] to leave the channel.
- You can call joinChannel [2/2] to rejoin the channel.
- If the SDK is banned from joining the channel by the Agora edge server through the RESTful API, the SDK triggers the onConnectionStateChanged callback.