logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

Manage room info


ZEGOCLOUD's In-app Chat (the ZIM SDK) provides the capability of room info queries, such as getting the room member list, querying the number of online members in the room, and more.

Note

You can only implement the following features in the room you created or joined.

Get room member list

After joining a room, to know who are in the current room and get the room member list, call the queryRoomMemberListByRoomID method with roomID and config parameters.

The config parameter refers to the configurations for querying room members. You will need to configure the parameters of the class ZIMRoomMemberQueryConfig according to the following:

ParameterTypeRequiredDescription
nextFlagstringYes

The paging identifier. Set this to null for the first query.

If the nextFlag field returned in the callback is not null, which means the query is not completed. In this case, you need to set it to the current position to continue the query on the next page.

countintYes

The number of room members that can be obtained in a query.

Note: To save overhead, we recommend you to obtain less than 100 members at a time.

Untitled
    ZIMRoomMemberQueryConfig *config = [[ZIMRoomMemberQueryConfig alloc] init];
    config.nextFlag = @"";
    config.count = 1;//1 indicates that get one member at a time.
    [zim queryRoomMemberListByRoomID:RoomID config:config callback:^(NSArray<ZIMUserInfo *> * _Nonnull memberList, NSString * _Nonnull nextFlag, ZIMError * _Nonnull errorInfo) {
        //Implement the event callback for getting the room member list here.
    }];
1
Copied!

Get the number of online room members

To get the number of the online room members, call the queryRoomOnlineMemberCountByRoomID method with the roomID.

Untitled
[zim queryRoomOnlineMemberCountByRoomID:<#(nonnull NSString *)#> callback:^(NSString * _Nonnull roomID, unsigned int count, ZIMError * _Nonnull errorInfo) {
        //Implement the event callback for querying the online room members. 
}];
1
Copied!
Note

A room member automatically gets offline if he calls the logout method to log out from the room.

Previous

Manage rooms

Next

Manage room properties