AgoraRtmDelegate Category 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:

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

- (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.

Declared In

AgoraRtmKit.h

– rtmKit:imageMessageReceived:fromPeer:

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

- (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.

Declared In

AgoraRtmKit.h

– rtmKit:media:uploadingProgress:

Reports the progress of an ongoing upload task.

- (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

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:

Reports the progress of an ongoing download task.

- (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

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 24-hour validity period and when the SDK is in the AgoraRtmConnectionStateReconnecting state.

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

Parameters

kit

An AgoraRtmKit instance.

Discussion

  • This callback occurs only when the SDK is reconnecting to the server. You will not receive this callback when the SDK is in the AgoraRtmConnectionStateConnected state.
  • When receiving this callback, generate a new RTM Token on the server and call the renewToken method to pass the new Token on to the server.

Declared In

AgoraRtmKit.h