Agora RTC Objective-C API Reference
Refactor
|
Inherits <NSObject>.
Instance Methods | |
(instancetype _Nullable) | - initWithConfig:delegate:error: |
(void) | - loginByToken:completion: |
(void) | - logout: |
(AgoraRtmStorage *_Nullable) | - getStorage |
(AgoraRtmLock *_Nullable) | - getLock |
(AgoraRtmPresence *_Nullable) | - getPresence |
(AgoraRtmHistory *_Nullable) | - getHistory |
(void) | - renewToken:completion: |
(void) | - subscribeWithChannel:option:completion: |
(void) | - unsubscribeWithChannel:completion: |
(void) | - publish:message:option:completion: |
(void) | - publish:data:option:completion: |
(void) | - addDelegate: |
(void) | - removeDelegate: |
(AgoraRtmStreamChannel *_Nullable) | - createStreamChannel:error: |
(AgoraRtmErrorCode) | - destroy |
Class Methods | |
(NSString *_Nullable) | + getErrorReason: |
(NSString *_Nonnull) | + getVersion |
The AgoraRtmClientKit class.
This class provides the main methods that can be invoked by your app.
AgoraRtmClientKit is the basic interface class of the Agora RTM SDK. Creating an AgoraRtmClientKit object and then calling the methods of this object enables you to use Agora RTM SDK's functional
- (instancetype _Nullable) NS_UNAVAILABLE |
- (instancetype _Nullable) initWithConfig: | (AgoraRtmClientConfig *_Nonnull) | config | |
delegate: | (id< AgoraRtmClientDelegate > _Nullable) | delegate | |
error: | (NSError **) | error | |
Initializes the rtm client instance.
config | The configurations for RTM Client. |
delegate | The callbacks handler. |
error | When get nil instance, get error info from error. |
error
parameter.- (void) loginByToken: | (NSString *_Nullable) | token | |
completion: | (AgoraRtmOperationBlock _Nullable) | completionBlock | |
Login the Agora RTM service.
token | Token used to login RTM service. |
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. |
- (void) logout: | (AgoraRtmOperationBlock _Nullable) | completionBlock |
Logout the Agora RTM service. Be noticed that this method will break the rtm service includeing storage/lock/presence.
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. |
- (AgoraRtmStorage* _Nullable) getStorage |
Get the storage instance.
- (AgoraRtmLock* _Nullable) getLock |
Get the lock instance.
- (AgoraRtmPresence* _Nullable) getPresence |
Get the presence instance.
- (AgoraRtmHistory* _Nullable) getHistory |
Get the history instance.
- (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.
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. |
- (void) subscribeWithChannel: | (NSString *_Nonnull) | channelName | |
option: | (AgoraRtmSubscribeOptions *_Nullable) | subscribeOption | |
completion: | (AgoraRtmOperationBlock _Nullable) | completionBlock | |
Subscribe a channel.
channelName | The name of the channel. |
subscribeOption | The options of subscribe the channel. |
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. |
- (void) unsubscribeWithChannel: | (NSString *_Nonnull) | channelName | |
completion: | (AgoraRtmOperationBlock _Nullable) | completionBlock | |
Unsubscribe a channel.
channelName | The name of the channel. |
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. |
- (void) publish: | (NSString *_Nonnull) | channelName | |
message: | (NSString *_Nonnull) | message | |
option: | (AgoraRtmPublishOptions *_Nullable) | publishOption | |
completion: | (AgoraRtmOperationBlock _Nullable) | completionBlock | |
Publish a message in the channel.
channelName | The name of the channel. |
message | The content of the string message. |
publishOption | 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. |
- (void) publish: | (NSString *_Nonnull) | channelName | |
data: | (NSData *_Nonnull) | data | |
option: | (AgoraRtmPublishOptions *_Nullable) | publishOption | |
completion: | (AgoraRtmOperationBlock _Nullable) | completionBlock | |
Publish a message in the channel.
channelName | The name of the channel. |
data | The content of the raw message. |
publishOption | 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. |
- (void) addDelegate: | (id< AgoraRtmClientDelegate > _Nonnull) | delegate |
add more delegate instance.
delegate | The name of the channel. |
- (void) removeDelegate: | (id< AgoraRtmClientDelegate > _Nonnull) | delegate |
remove delegate instance.
delegate | The name of the channel. |
+ (NSString* _Nullable) getErrorReason: | (AgoraRtmErrorCode) | errorCode |
Convert error code to error string.
errorCode | Received error code |
+ (NSString * _Nonnull) getVersion |
Get the version info of the AgoraRtmKit.
- (AgoraRtmStreamChannel * _Nullable) createStreamChannel: | (NSString *_Nonnull) | channelName | |
error: | (NSError **) | error | |
create a stream channel instance.
channelName | The Name of the channel. |
error | When get nil instance, get error info from error. |
error
parameter.- (AgoraRtmErrorCode) destroy |
destroy the rtm client instance.