AgoraRtmChannel Class Reference

Inherits from NSObject
Declared in AgoraRtmKit.h

Overview

Agora RTM channel methods.

  kit

An AgoraRtmKit instance.

@property (atomic, readonly, nonnull) AgoraRtmKit *kit

Declared In

AgoraRtmKit.h

  channelDelegate

AgoraRtmChannelDelegate enables Agora RTM channel callback event notifications to your app.

@property (nonatomic, weak, nullable) id<AgoraRtmChannelDelegate> channelDelegate

Declared In

AgoraRtmKit.h

– joinWithCompletion:

Joins a channel.

- (void)joinWithCompletion:(AgoraRtmJoinChannelBlock _Nullable)completionBlock

Parameters

completionBlock

AgoraRtmJoinChannelBlock returns the result of this method call. See AgoraRtmJoinChannelErrorCode for the error codes.

Discussion

NOTE

You can join a maximum of 20 RTM channels at the same time. When the number of the channels you join exceeds the limit, you receive the AgoraRtmJoinChannelErrorCodeExceedLimit error code.

  • The AgoraRtmJoinChannelBlock callback returns the result of this method call.

  • When the local user successfully joins the channel, all remote users in the channel receive the memberJoined callback.

Declared In

AgoraRtmKit.h

– leaveWithCompletion:

Leaves a channel.

- (void)leaveWithCompletion:(AgoraRtmLeaveChannelBlock _Nullable)completionBlock

Parameters

completionBlock

AgoraRtmLeaveChannelBlock returns the result of this method call. See AgoraRtmLeaveChannelErrorCode for the error codes.

Discussion

  • The AgoraRtmLeaveChannelBlock callback returns the result of this method call.

  • When the local user successfully leaves the channel, all remote users in the channel receive the memberLeft callback.

Declared In

AgoraRtmKit.h

– sendMessage:completion:

DEPRECATED Allows a channel member to send a message to all members in the channel.

- (void)sendMessage:(AgoraRtmMessage *_Nonnull)message completion:(AgoraRtmSendChannelMessageBlock _Nullable)completionBlock

Parameters

message

The message to be sent. See AgoraRtmMessage.

completionBlock

AgoraRtmSendChannelMessageBlock returns the result of this method call. See AgoraRtmSendChannelMessageErrorCode for the error codes.

Discussion

Agora does not recommend using this method for sending a channel message. Use sendMessage instead.

NOTE

You can send messages, including peer-to-peer and channel messages, at a maximum speed of 180 calls every three seconds.

Declared In

AgoraRtmKit.h

– sendMessage:sendMessageOptions:completion:

Allows a channel member to send a message to all members in the channel.

- (void)sendMessage:(AgoraRtmMessage *_Nonnull)message sendMessageOptions:(AgoraRtmSendMessageOptions *_Nonnull)options completion:(AgoraRtmSendChannelMessageBlock _Nullable)completionBlock

Parameters

message

The message to be sent. See AgoraRtmMessage.

options

Options when sending a channel message. See AgoraRtmSendMessageOptions.

completionBlock

AgoraRtmSendChannelMessageBlock returns the result of this method call. See AgoraRtmSendChannelMessageErrorCode for the error codes.

Discussion

NOTE

You can send messages, including peer-to-peer and channel messages, at a maximum speed of 180 calls every three seconds.

Declared In

AgoraRtmKit.h

– getMembersWithCompletion:

Retrieves a member list of the channel.

- (void)getMembersWithCompletion:(AgoraRtmGetMembersBlock _Nullable)completionBlock

Parameters

completionBlock

AgoraRtmGetMembersBlock returns the result of this method call (the member list if success). See AgoraRtmGetMembersErrorCode for the error codes.

Discussion

NOTE

You can call this method at a maximum frequency of five calls every two seconds. This method returns a maximum of 512 members. If the number of channel members exceed 512, the method returns 512 members randomly.

Declared In

AgoraRtmKit.h