Large-scale room
Large-scale room
1.It is possible to create large-scale rooms in the background.
2.When the number of users in a one-to-many room reaches 100, the room will automatically be upgraded to a large room. You can monitor the msgName in the - (void)roomManagerOnRemotePubMsgWithMsgID:(NSString )msgID msgName:(NSString )msgName data:(NSObject )data fromID:(NSString )fromID inList:(BOOL)inlist ts:(long)ts callback. If msgName is "BigRoom", it indicates that the room has been upgraded to a large room.
3.The following interfaces are effective only when called in the context of a large room.
getRoomUserWithPeerId
In a large room, retrieve information of a specified user
- (int)getRoomUserWithPeerId:(NSString *)peerID callback:(void (^)(TKRoomUser *_Nullable user, NSError *_Nullable error))callback;
Parameter Name |
Required |
Type |
Description |
peerID |
Yes |
NSString |
User ID |
callback |
Yes |
(void (^)(TKRoomUser _Nullable user, NSError _Nullable error) |
Callback for retrieved user information |
| [_roomMgr getRoomUserWithPeerId:@"adc123456"
callback:^(TKRoomUser * _Nullable user, NSError * _Nullable error) {
NSLog(@"用户ID = %@, 昵称 = %@", user.peerID, user.nickName);
}];
|
Type |
Description |
int |
Return the playback audio identifier, the playback ID. If -1 is returned, it indicates playback failure. |
getRoomUserNumberWithRole
Get the number of specific users in a large room
Search for users based on user roles, then match user nicknames, and return the count
| - (int)getRoomUserNumberWithRole:(NSArray * _Nullable)role
search:(NSString * _Nullable)search
callback:(void (^)(NSInteger num, NSError *error))callback;
|
Parameter Name |
Required |
Type |
Description |
role |
Yes |
NSArray |
Array of user roles |
search |
No |
NSString |
Search condition: Match user nickname |
callback |
Yes |
void (^)(NSInteger num, NSError *error) |
Request callback |
| [_roomMgr getRoomUserNumberWithRole:[@2]
search:nil
callback:^(NSInteger num, NSError * _Nonnull error) {
NSLog(@"num = %zd", num);
}];
|
Type |
Description |
int |
Return the playback audio identifier, the playback ID. If -1 is returned, it indicates playback failure. |
getRoomUsersWithRole
In a large room, retrieve the list of users in the room
Request users based on roles, in a paginated manner, to obtain a specific number of users.
| - (int)getRoomUsersWithRole:(NSArray * _Nullable)role
startIndex:(NSInteger)start
maxNumber:(NSInteger)max
search:(NSString * _Nullable)search
order:(NSDictionary * _Nullable)order
callback:(void (^)(NSArray <TKRoomUser *>* _Nonnull users , NSError *error) )callback;
|
Parameter Name |
Required |
Type |
Description |
role |
No |
NSArray |
User role |
start |
Yes |
NSInteger |
Starting position, for example: 0, 20, 40, etc |
max |
Yes |
NSInteger |
Maximum number, for example: 20 |
search |
No |
NSString |
Search condition: Match user nickname, can be nil |
order |
No |
NSDictionary |
Sorting condition: You can choose a user attribute as the sorting condition. asc for ascending order, dsc for descending order. For example: @"role" : @"asc", can be nil |
callback |
Yes |
void (^)(NSArray _Nonnull users , NSError error) |
Request callback |
| [_roomMgr getRoomUsersWithRole:nil
startIndex:0
maxNumber:20
search:nil
order:@{@"role" : @"asc"}
callback:^(NSArray<TKRoomUser *> * _Nonnull users, NSError * _Nullable error) {
}];
|
Type |
Description |
int |
Return the playback audio identifier, the playback ID. If -1 is returned, it indicates playback failure. |
batchChangeUserPropertyByIds
In a large room, change the attributes of specified users in batches
| - (int)batchChangeUserPropertyByIds:(NSArray<NSString *> *)peerIDs
tellWhom:(NSString *)tellWhom
property:(NSDictionary *)properties
extensionJson:(NSDictionary * _Nullable)extensionJson
completion:(completion_block _Nullable)completion;
- (int)batchChangeUserPropertyByIds:(NSArray <NSString *>*)peerIDs
tellWhom:(NSString *)tellWhom
property:(NSDictionary *)properties
completion:(completion_block _Nullable)completion;
|
Parameter Name |
Required |
Type |
Description |
peerIDs |
Yes |
NSArray |
User ID |
tellWhom |
Yes |
NSString |
The object to which this modification signal needs to be notified. Type is NSString, for details, see the relevant definitions in TKRoomDefines.h. It can be a specific user ID, indicating that the signal is sent only to that user |
properties |
Yes |
NSDictionary |
The attributes of the user being modified |
extensionJson |
No |
NSDictionary |
Extended information |
completion |
No |
completion_block |
Callback for the completion of the call |
| [_roomMgr batchChangeUserPropertyByIds:@[@"adc123456", @"adc235641"]
tellWhom:TKRoomPubMsgTellAll
property:@{@"giftNumber" : @"1"}
extensionJson:nil
completion:nil];
|
Type |
Description |
int |
Return the playback audio identifier, the playback ID. If -1 is returned, it indicates playback failure. |
changeUserPropertyByRole
In a large room, change the attributes of users with a specified role
| - (int)changeUserPropertyByRole:(NSArray *)roles
tellWhom:(NSString *)tellWhom
property:(NSDictionary *)properties
extensionJson:(NSDictionary * _Nullable)extensionJson
completion:(completion_block _Nullable)completion;
- (int)changeUserPropertyByRole:(NSArray *)roles
tellWhom:(NSString *)tellWhom
property:(NSDictionary *)properties
completion:(completion_block _Nullable)completion;
|
Parameter Name |
Required |
Type |
Description |
roles |
Yes |
NSArray |
User role |
tellWhom |
No |
NSString |
The target to which this modification signal needs to be notified. Type is NSString. For details, refer to the relevant definitions in TKRoomDefines.h. It can be a specific user ID, indicating that the signal is sent only to that user. |
properties |
Yes |
NSDictionary |
The attributes of the user being modified |
extensionJson |
No |
NSDictionary |
Extended information |
completion |
Yes |
completion_block |
Callback for the completion of the call |
| [_roomMgr changeUserPropertyByRole:@[@"1", @"2"]
tellWhom:TKRoomPubMsgTellAll
property:@{@"giftNumber" : @"1"}
extensionJson:nil
completion:nil];
|
Type |
Description |
int |
Return the playback audio identifier, the playback ID. If -1 is returned, it indicates playback failure. |
getUsersByProperty
In a large room, retrieve the list of users with the same attributes
- (int)getUsersByProperty:(NSDictionary *)properties callback:(void (^)(NSArray<TKRoomUser *> *list, NSError * _Nullable error))callback;
Parameter Name |
Required |
Type |
Description |
properties |
Yes |
NSDictionary |
User attributes, which must include the following fields: @"key" (attribute name), @"operator" (for details, refer to the enumeration definition of TKOperator in TKRoomDefines.h), and @"value" (the value corresponding to the attribute name). Optional fields include @"start", @"max", etc. For example: @{@"key" : @"publishstate", @"operator" : @"1", @"value" : @"0"} |
callback |
No |
void (^)(NSArray *list, NSError * _Nullable error) |
Callback |
| [_roomMgr getUsersByProperty:@{@"key" : @"publishstate", @"operator" : @“1”, @"value" : @”0“}
callback:^(NSArray<TKRoomUser *> * _Nonnull list, NSError * _Nullable error) {
}];
|
Type |
Description |
int |
Return the playback audio identifier, the playback ID. If -1 is returned, it indicates playback failure. |
Notes
For more return error codes, please refer to the error code descriptions in TKRoomErrorCode