Agora RTC Objective-C API Reference Refactor

Instance Methods
AgoraRtmStreamChannel Class Reference

Inherits <NSObject>.

## Instance Methods
(void) | - joinWithOption:completion:
(void) | - leave:
(void) | - renewToken:completion:
(void) | - joinTopic:option:completion:
(void) | - leaveTopic:completion:
(void) | - subscribeTopic:option:completion:
(void) | - unsubscribeTopic:option:completion:
(void) | - publishTopicMessage:message:option:completion:
(void) | - publishTopicMessage:data:option:completion:
(void) | - getSubscribedUserList:completion:
(NSString *_Nonnull) | - getChannelName
(AgoraRtmErrorCode) | - destroy

## Method Documentation

## ◆ NS_UNAVAILABLE

- (instancetype _Nullable) NS_UNAVAILABLE |  |  |

## ◆ joinWithOption:completion:

- (void) joinWithOption: |  | (AgoraRtmJoinChannelOption *_Nonnull) | option
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

Join the channel.

Parameters

  option | join channel options.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ leave:

- (void) leave: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock |

Leave the channel.

Parameters

  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ renewToken:completion:

- (void) renewToken: |  | (NSString *_Nonnull) | token
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

Renews the token. Once a token is enabled and used, it expires after a certain period of time. You should generate a new token on your server, call this method to renew it.

Parameters

  token | token Token used renew.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ joinTopic:option:completion:

- (void) joinTopic: |  | (NSString *_Nonnull) | topic
option: |  | (AgoraRtmJoinTopicOption *_Nullable) | option
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

Join a topic.

Parameters

  topic | The name of the topic.
  option | The options of the topic.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ leaveTopic:completion:

- (void) leaveTopic: |  | (NSString *_Nonnull) | topic
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

Leave the topic.

Parameters

  topic | The name of the topic.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ subscribeTopic:option:completion:

- (void) subscribeTopic: |  | (NSString *_Nonnull) | topic
option: |  | (AgoraRtmTopicOption *_Nullable) | option
completion: |  | (AgoraRtmTopicSubscriptionBlock _Nullable) | completionBlock

Subscribe a topic.

Parameters

  topic | The name of the topic.
  option | The options of subscribe the topic.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ unsubscribeTopic:option:completion:

- (void) unsubscribeTopic: |  | (NSString *_Nonnull) | topic
option: |  | (AgoraRtmTopicOption *_Nullable) | option
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

UnsubscribeTopic a topic.

Parameters

  topic | The name of the topic.
  option | The options of subscribe the topic.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ publishTopicMessage:message:option:completion:

- (void) publishTopicMessage: |  | (NSString *_Nonnull) | topic
message: |  | (NSString *_Nonnull) | message
option: |  | (AgoraRtmTopicMessageOptions *_Nullable) | options
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

publish a message in the topic.

Parameters

  topic | The name of the topic.
  message | The content of string message.
  options | The option of the message.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ publishTopicMessage:data:option:completion:

- (void) publishTopicMessage: |  | (NSString *_Nonnull) | topic
data: |  | (NSData *_Nonnull) | data
option: |  | (AgoraRtmTopicMessageOptions *_Nullable) | options
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

publish a message in the topic.

Parameters

  topic | The name of the topic.
  message | The content of raw message.
  options | The option of the message.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ getSubscribedUserList:completion:

- (void) getSubscribedUserList: |  | (NSString *_Nonnull) | topic
completion: |  | (AgoraRtmGetTopicSubscribedUsersBlock _Nullable) | completionBlock

Get subscribed user list

Parameters

  topic | The name of the topic.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ getChannelName

- (NSString * _Nonnull) getChannelName |  |  |

return the channel name of this stream channel.

Returns
  The channel name.

## ◆ destroy

- (AgoraRtmErrorCode) destroy |  |  |

release the stream channel instance.

Returns
  - AgoraRtmErrorOk: Success.
    - other: Failure.