AgoraRtmConnectionState Constants Reference

Declared in AgoraRtmKit.h

AgoraRtmConnectionState

Connection states between the SDK and the Agora RTM system.

Definition

typedef NS_ENUM(NSInteger, AgoraRtmConnectionState ) {
   AgoraRtmConnectionStateDisconnected = 1,
   AgoraRtmConnectionStateConnecting = 2,
   AgoraRtmConnectionStateConnected = 3,
   AgoraRtmConnectionStateReconnecting = 4,
   AgoraRtmConnectionStateAborted = 5,
};

Constants

AgoraRtmConnectionStateDisconnected

1: The initial state. The SDK is disconnected from the Agora RTM system.

When the user calls the loginByToken method, the SDK starts to log in the Agora RTM system, triggers the connectionStateChanged callback, and switches to the AgoraRtmConnectionStateConnecting state.

Declared In AgoraRtmKit.h.

AgoraRtmConnectionStateConnecting

2: The SDK is logging in the Agora RTM system.

  • Success: The SDK triggers the connectionStateChanged callback and switches to the AgoraRtmConnectionStateConnected state.
  • Failure: The SDK triggers the connectionStateChanged callback and switches to the AgoraRtmConnectionStateDisConnected state.
  • Declared In AgoraRtmKit.h.

    AgoraRtmConnectionStateConnected

    3: The SDK has logged in the Agora RTM system.

  • If the connection between the SDK and the Agora RTM system is interrupted because of network issues, the SDK triggers the connectionStateChanged callback and switches to the AgoraRtmConnectionStateReconnecting state.
  • If the login is banned by the server because, for example, another instance logs in the Agora RTM system with the same user ID, the SDK triggers the connectionStateChanged callback and switches to the AgoraRtmConnectionStateAborted state.
  • If the user calls the logoutWithCompletion method to log out of the Agora RTM system and receives AgoraRtmLogoutErrorOk, the SDK triggers the connectionStateChanged callback and switches to the AgoraRtmConnectionStateDisconnected state.
  • Declared In AgoraRtmKit.h.

    AgoraRtmConnectionStateReconnecting

    4: The connection state between the SDK and the Agora RTM system is interrupted due to network issues, and the SDK keeps re-logging in the Agora RTM system.

  • If the SDK successfully re-logs in the Agora RTM system, it triggers the connectionStateChanged callback and switches to the AgoraRtmConnectionStateConnected state. The SDK automatically adds the user back to the channels he or she was in when the connection was interrupted, and synchronizes the local user’s attributes with the server.
  • If the SDK fails to re-log in the Agora RTM system, the SDK stays in the AgoraRtmConnectionStateReconnecting state and keeps re-logging in the system.
  • Declared In AgoraRtmKit.h.

    AgoraRtmConnectionStateAborted

    5: The SDK gives up logging in the Agora RTM system, mainly because another instance has logged in the Agora RTM system with the same user ID.

    You must call the logoutWithCompletion method before calling the loginByToken method to log in the Agora RTM system again.

    Declared In AgoraRtmKit.h.

    Declared In

    AgoraRtmKit.h