Agora RTC Objective-C API Reference  Refactor
Instance Methods
AgoraRtmPresence Class Reference

Inherits <NSObject>.

Instance Methods

(void) - whoNow:channelType:options:completion:
 
(void) - getOnlineUsers:channelType:options:completion:
 
(void) - whereNow:completion:
 
(void) - getUserChannels:completion:
 
(void) - setState:channelType:items:completion:
 
(void) - removeState:channelType:keys:completion:
 
(void) - getState:channelType:userId:completion:
 

Detailed Description

The IRtmPresence class.

This class provides the rtm presence methods that can be invoked by your app.

Method Documentation

◆ NS_UNAVAILABLE

- (instancetype _Nullable) NS_UNAVAILABLE

◆ whoNow:channelType:options:completion:

- (void) whoNow: (NSString *_Nonnull)  channelName
channelType: (AgoraRtmChannelType channelType
options: (AgoraRtmPresenceOptions *_Nullable)  options
completion: (AgoraRtmWhoNowBlock _Nullable)  completionBlock 

To query who joined this channel

Parameters
channelNameThe name of the channel.
channelTypeThe type of the channel.
optionsThe query option.
completionBlockThe 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.

◆ getOnlineUsers:channelType:options:completion:

- (void) getOnlineUsers: (NSString *_Nonnull)  channelName
channelType: (AgoraRtmChannelType channelType
options: (AgoraRtmGetOnlineUsersOptions *_Nullable)  options
completion: (AgoraRtmGetOnlineUsersBlock _Nullable)  completionBlock 

To query who joined this channel

Parameters
channelNameThe name of the channel.
channelTypeThe type of the channel.
optionsThe query option.
completionBlockThe 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.

◆ whereNow:completion:

- (void) whereNow: (NSString *_Nonnull)  userId
completion: (AgoraRtmWhereNowBlock _Nullable)  completionBlock 

To query which channels the user joined

Parameters
userIdThe id of the user.
completionBlockThe 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.

◆ getUserChannels:completion:

- (void) getUserChannels: (NSString *_Nonnull)  userId
completion: (AgoraRtmGetUserChannelsBlock _Nullable)  completionBlock 

To query which channels the user joined

Parameters
userIdThe id of the user.
completionBlockThe 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.

◆ setState:channelType:items:completion:

- (void) setState: (NSString *_Nonnull)  channelName
channelType: (AgoraRtmChannelType channelType
items: (NSDictionary< NSString *, NSString * > *_Nonnull)  items
completion: (AgoraRtmOperationBlock _Nullable)  completionBlock 

Set user state

Parameters
channelNameThe name of the channel.
channelTypeThe type of the channel.
itemsThe states item of user.
completionBlockThe 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.

◆ removeState:channelType:keys:completion:

- (void) removeState: (NSString *_Nonnull)  channelName
channelType: (AgoraRtmChannelType channelType
keys: (NSArray< NSString * > *_Nonnull)  keys
completion: (AgoraRtmOperationBlock _Nullable)  completionBlock 

Delete user state

Parameters
channelNameThe name of the channel.
channelTypeThe type of the channel.
keysThe keys of state item.
completionBlockThe 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.

◆ getState:channelType:userId:completion:

- (void) getState: (NSString *_Nonnull)  channelName
channelType: (AgoraRtmChannelType channelType
userId: (NSString *_Nonnull)  userId
completion: (AgoraRtmPresenceGetStateBlock _Nullable)  completionBlock 

Get user state

Parameters
channelNameThe name of the channel.
channelTypeThe type of the channel.
userIdThe id of the user.
completionBlockThe 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.