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.
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.Then, the callback ZIMRoomMemberQueriedCallback is used to return the member list in the room.
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:
Parameter | Type | Required | Description |
---|---|---|---|
nextFlag | string | Yes | The paging identifier. Set this to null for the first query. If the |
count | int | Yes | 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. |
ZIMRoomMemberQueryConfig zimQueryMemberConfig = new ZIMRoomMemberQueryConfig();
zimQueryMemberConfig.count = 100;
ZIM.GetInstance().QueryRoomMemberList("roomID", zimQueryMemberConfig, (string roomID, List<ZIMUserInfo> memberList, string nextFlag, ZIMError errorInfo) =>
{
}
);
Get the number of online room members
To get the number of the online room members, call the queryRoomOnlineMemberCount method with the roomID
.
// Get the number of online room members
ZIM.GetInstance().QueryRoomOnlineMemberCount("roomID", (string roomID, uint count, ZIMError errorInfo) =>
{
}
);
A room member automatically gets offline if he calls the logout method to log out from the room.