

You can call logout to log out of the system first, and then call the login method to reconnect at an appropriate time. If the reconnection keeps failing, the connection state remains at RECONNECTING. The SDK resends messages that occurred during the disconnection period according to the following guidelines:ĭuring the reconnection period, the SDK continues to send all channel and peer-to-peer messages until the message request times out.Īfter the reconnection succeeds, the RTM system resends all of the peer-to-peer messages sent during the disconnection period but only the channel messages from the 30-second period immediately before reconnection (up to a maximum of 32 messages) to the receiver. After successful reconnection, the connection state changes to CONNECTED. When in the RECONNECTING state, the RTM SDK continues to automatically reconnect to the RTM system until the login is successful, so you do not need to perform any login operations. When the connection state is CONNECTED, if the connection with the Agora RTM system is interrupted and cannot recover in four seconds due to network reasons, the connection state changes to RECONNECTING, and the cause for the state change is INTERRUPTED. Disconnected from the RTM system due to network problems When the connection state turns to DISCONNECTED, you need to call login again to log in.

DISCONNECTED: The login fails or times out (the user fails to log in within 12 seconds).When the state is CONNECTING, the connection state automatically changes to one of the following states: When you call login to log in to the RTM system, the connection state changes from DISCONNECTED to CONNECTING, and the cause for the state change is LOGIN. You can use the state and cause for the state change returned by the ConnectionStateChanged callback to actively call the API to change the connection state in the following situations. You can manage connection states through this callback. Whenever the connection state changes, the RTM SDK returns the latest state (the ConnectionState enumeration) and the cause for the state change (the ConnectionChangeReason enumeration) through the ConnectionStateChanged callback.
