logo
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 queryRoomMemberList method with roomID and config parameters.And the room member list will be returned through the callback ZIMRoomMemberQueriedResult.

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.

countnumberYes

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
var roomID = '';
var config = { count: 10, nextFlag: '' };

zim.queryRoomMemberList(roomID, config)
    .then(function ({ roomID, memberList, nextFlag }) {
        // Query successful.
    })
    .catch(function (err) {
        // Query failed.
    });
1
Copied!

Get the number of online room members

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

Untitled
var roomID = '';

zim.queryRoomOnlineMemberCount(roomID, config)
    .then(function ({ roomID, count }) {
        // Query successful.
    })
    .catch(function (err) {
        // Query failed.
    });
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