Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraRtmClientDelegate> Protocol Reference

Inherits <NSObjectNSObject>.

## Instance Methods
(void) | - rtmKit:onMessageEvent:
(void) | - rtmKit:onPresenceEvent:
(void) | - rtmKit:onUser:joinChannel:result:
(void) | - rtmKit:onUser:leaveChannel:result:
(void) | - rtmKit:onUser:joinTopic:inChannel:withMeta:result:
(void) | - rtmKit:onUser:leaveTopic:inChannel:withMeta:result:
(void) | - rtmKit:onUser:inTopic:inChannel:withSubscribeSuccess:withSubscribeFailed:result:
(void) | - rtmKit:onUser:inTopic:inChannel:withUnsubscribeSuccess:withUnsubscribeFailed:result:
(void) | - rtmKit:channel:connectionStateChanged:result:

## Method Documentation

## ◆ rtmKit:onMessageEvent:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onMessageEvent: |  | (AgoraRtmMessageEvent *_Nonnull) | event
| optional

Occurs when receive a message.

Parameters

  event | details of message event.

## ◆ rtmKit:onPresenceEvent:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onPresenceEvent: |  | (AgoraRtmPresenceEvent *_Nonnull) | event
| optional

Occurs when remote user join/leave channel, join/leave topic or local user joined channel.

note: When remote user join/leave channel will trigger this callback. When remote user(in same channel) joinTopic/destroy Topic will trigger this callback. When local user join channel will trigger this callback.

For type(AgoraRtmPresenceTypeRemoteJoinChannel/AgoraRtmPresenceTypeRemoteLeaveChannel), valid field will be channelType/type/channelName/userId For type(AgoraRtmPresenceTypeRemoteJoinTopic/AgoraRtmPresenceTypeRemoteLeaveTopic) valid field will be channelType/type/channelName/topicInfos/topicInfoNumber For type(AgoraRtmPresenceTypeSelfJoinChannel) valid field will be channelType/type/channelName/topicInfos/topicInfoNumber/userId

Parameters

  event | details of presence event.

## ◆ rtmKit:onUser:joinChannel:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onUser: |  | (NSString *_Nonnull) | userId
joinChannel: |  | (NSString *_Nonnull) | channelName
result: |  | (AgoraRtmStreamChannelErrorCode) | errorCode
| optional

Occurs when user join a channel.

Parameters

  channelName | The Name of the channel.
  userId | The id of the user.
  errorCode | The error code.

## ◆ rtmKit:onUser:leaveChannel:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onUser: |  | (NSString *_Nonnull) | userId
leaveChannel: |  | (NSString *_Nonnull) | channelName
result: |  | (AgoraRtmStreamChannelErrorCode) | errorCode
| optional

Occurs when user leave a channel.

Parameters

  channelName | The Name of the channel.
  userId | The id of the user.
  errorCode | The error code.

## ◆ rtmKit:onUser:joinTopic:inChannel:withMeta:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onUser: |  | (NSString *_Nonnull) | userId
joinTopic: |  | (NSString *_Nonnull) | topic
inChannel: |  | (NSString *_Nonnull) | channelName
withMeta: |  | (NSData *_Nullable) | meta
result: |  | (AgoraRtmStreamChannelErrorCode) | errorCode
| optional

Occurs when user join topic.

Parameters

  channelName | The Name of the channel.
  userId | The id of the user.
  topic | The name of the topic.
  meta | The meta of the topic.
  errorCode | The error code.

## ◆ rtmKit:onUser:leaveTopic:inChannel:withMeta:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onUser: |  | (NSString *_Nonnull) | userId
leaveTopic: |  | (NSString *_Nonnull) | topic
inChannel: |  | (NSString *_Nonnull) | channelName
withMeta: |  | (NSData *_Nullable) | meta
result: |  | (AgoraRtmStreamChannelErrorCode) | errorCode
| optional

Occurs when user leave topic.

Parameters

  channelName | The Name of the channel.
  userId | The id of the user.
  topic | The name of the topic.
  meta | The meta of the topic.
  errorCode | The error code.

## ◆ rtmKit:onUser:inTopic:inChannel:withSubscribeSuccess:withSubscribeFailed:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onUser: |  | (NSString *_Nonnull) | userId
inTopic: |  | (NSString *_Nonnull) | topic
inChannel: |  | (NSString *_Nonnull) | channelName
withSubscribeSuccess: |  | (NSArray< NSString * > *_Nonnull) | succeedUsers
withSubscribeFailed: |  | (NSArray< NSString * > *_Nonnull) | failedUsers
result: |  | (AgoraRtmStreamChannelErrorCode) | errorCode
| optional

Occurs when user subscribe topic.

Parameters

  channelName | The Name of the channel.
  userId | The id of the user.
  topic | The name of the topic.
  succeedUsers | The subscribed users.
  failedUsers | The failed to subscribe users.
  errorCode | The error code.

## ◆ rtmKit:onUser:inTopic:inChannel:withUnsubscribeSuccess:withUnsubscribeFailed:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | rtmKit
onUser: |  | (NSString *_Nonnull) | userId
inTopic: |  | (NSString *_Nonnull) | topic
inChannel: |  | (NSString *_Nonnull) | channelName
withUnsubscribeSuccess: |  | (NSArray< NSString * > *_Nonnull) | succeedUsers
withUnsubscribeFailed: |  | (NSArray< NSString * > *_Nonnull) | failedUsers
result: |  | (AgoraRtmStreamChannelErrorCode) | errorCode
| optional

Occurs when user unsubscribe topic.

Parameters

  channelName | The Name of the channel.
  userId | The id of the user.
  topic | The name of the topic.
  succeedUsers | The unsubscribed users.
  failedUsers | The failed to unsubscribe users.
  errorCode | The error code.

## ◆ rtmKit:channel:connectionStateChanged:result:

- (void) rtmKit: |  | (AgoraRtmClientKit *_Nonnull) | kit
channel: |  | (NSString *_Nonnull) | channelName
connectionStateChanged: |  | (AgoraRtmClientConnectionState) | state
result: |  | (AgoraRtmClientConnectionChangeReason) | reason
| optional

Occurs when the connection state changes between rtm sdk and agora service.

Parameters

  channelName | The Name of the channel.
  state | The new connection state.
  reason | The reason for the connection state change.