AgoraRtmDelegate Protocol Reference

Conforms to NSObject
Declared in AgoraRtmKit.h

Overview

The AgoraRtmDelegate protocol enables Agora RTM callback event notifications to your app.

– rtmKit:connectionStateChanged:reason:

Occurs when the connection state between the SDK and the Agora RTM system changes.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit connectionStateChanged:(AgoraRtmConnectionState)state reason:(AgoraRtmConnectionChangeReason)reason

Parameters

kit

An AgoraRtmKit instance.

state

The new connection state. See AgoraRtmConnectionState.

reason

The reason for the connection state change. See AgoraRtmConnectionChangeReason.

Declared In

AgoraRtmKit.h

– rtmKit:messageReceived:fromPeer:

Occurs when receiving a peer-to-peer message.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit messageReceived:(AgoraRtmMessage *_Nonnull)message fromPeer:(NSString *_Nonnull)peerId

Parameters

kit

An AgoraRtmKit instance.

message

The received message. Ensure that you check the type property when receiving the message instance: If the message type is AgoraRtmMessageTypeRaw, you need to downcast the received instance from AgoraRtmMessage to AgoraRtmRawMessage. See AgoraRtmMessageType.

peerId

The user ID of the sender.

Declared In

AgoraRtmKit.h

– rtmKit:fileMessageReceived:fromPeer:

DEPRECATED Deprecated as of v1.5.0. Agora recommends that you do not use it.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit fileMessageReceived:(AgoraRtmFileMessage *_Nonnull)message fromPeer:(NSString *_Nonnull)peerId

Parameters

kit

An AgoraRtmKit instance.

message

The received peer-to-peer file message. See AgoraRtmFileMessage.

peerId

The ID of the message sender.

Discussion

Occurs when receiving a peer-to-peer file message.

Declared In

AgoraRtmKit.h

– rtmKit:imageMessageReceived:fromPeer:

DEPRECATED Deprecated as of v1.5.0. Agora recommends that you do not use it.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit imageMessageReceived:(AgoraRtmImageMessage *_Nonnull)message fromPeer:(NSString *_Nonnull)peerId

Parameters

kit

An AgoraRtmKit instance.

message

The received peer-to-peer image message. See AgoraRtmImageMessage.

peerId

The ID of the message sender.

Discussion

Occurs when receiving a peer-to-peer image message.

Declared In

AgoraRtmKit.h

– rtmKit:media:uploadingProgress:

DEPRECATED Deprecated as of v1.5.0. Agora recommends that you do not use it.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit media:(long long)requestId uploadingProgress:(AgoraRtmMediaOperationProgress *_Nonnull)progress

Parameters

kit

An AgoraRtmKit instance.

requestId

The unique ID of the upload request.

progress

The progress of the ongoing upload task. See AgoraRtmMediaOperationProgress.

Discussion

Reports the progress of an ongoing upload task.

NOTE

  • If the upload task is ongoing, the SDK returns this callback once every second.
  • If the upload task comes to a halt, the SDK stops returning this callback until the task is going again.

Declared In

AgoraRtmKit.h

– rtmKit:media:downloadingProgress:

DEPRECATED Deprecated as of v1.5.0. Agora recommends that you do not use it.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit media:(long long)requestId downloadingProgress:(AgoraRtmMediaOperationProgress *_Nonnull)progress

Parameters

kit

An AgoraRtmKit instance.

requestId

The unique ID of the download request.

progress

The progress of the ongoing download task. See AgoraRtmMediaOperationProgress.

Discussion

Reports the progress of an ongoing download task.

NOTE

  • If the download task is ongoing, the SDK returns this callback once every second.
  • If the download task comes to a halt, the SDK stops returning this callback until the task is going again.

Declared In

AgoraRtmKit.h

– rtmKit:PeersOnlineStatusChanged:

Occurs when the online status of the peers, to whom you subscribe, changes.

- (void)rtmKit:(AgoraRtmKit *_Nonnull)kit PeersOnlineStatusChanged:(NSArray<AgoraRtmPeerOnlineStatus*> *_Nonnull)onlineStatus

Parameters

kit

An AgoraRtmKit instance.

onlineStatus

An array of peers' online states. See AgoraRtmPeerOnlineStatus.

Discussion

  • When the subscription to the online status of specified peers succeeds, the SDK returns this callback to report the online status of peers, to whom you subscribe.
  • When the online status of the peers, to whom you subscribe, changes, the SDK returns this callback to report whose online status has changed.
  • If the online status of the peers, to whom you subscribe, changes when the SDK is reconnecting to the server, the SDK returns this callback to report whose online status has changed when successfully reconnecting to the server.

Declared In

AgoraRtmKit.h

– rtmKitTokenDidExpire:

Occurs when the RTM server detects that the RTM token has exceeded the specified validity period.

- (void)rtmKitTokenDidExpire:(AgoraRtmKit *_Nonnull)kit

Parameters

kit

An AgoraRtmKit instance.

Discussion

  • If the SDK is in the AgoraRtmConnectionStateConnected state, the connection state switches to AgoraRtmConnectionStateAborted and you need to call the loginByToken method to log in again.
  • If the SDK is in the AgoraRtmConnectionStateReconnecting state, you will receive this callback when the network reconnects and you need to call renewToken to pass the new token on to the server.

Declared In

AgoraRtmKit.h

– rtmKitTokenPrivilegeWillExpire:

Occurs when the token expires in 30 seconds.

- (void)rtmKitTokenPrivilegeWillExpire:(AgoraRtmKit *_Nonnull)kit

Parameters

kit

An AgoraRtmKit instance.

Discussion

  • Upon receiving this callback, generate a new token on the server and call the renewToken method to pass the new token to the SDK.
  • If the token used in a loginByToken session expires, the user becomes offline and the SDK attempts to reconnect.

Declared In

AgoraRtmKit.h