Skip to main content

Query Chatroom Information

Retrieve chatroom information, which can return the following data:

  • Total number of chatroom members
  • A list of a specified number (up to 20) of chatroom members, including the member's user ID and the time they joined the chatroom
tip

Rate Limit: A single device can call this API once per second, with a maximum of 20 calls per minute per device.

You can use the getChatRoomInfo method under RCIMClient or RCChatRoomClient:

[[RCIMClient sharedRCIMClient] getChatRoomInfo:@"chatroomId"
count:0
order:RC_ChatRoom_Member_Asc
success:^(RCChatRoomInfo *chatRoomInfo) {
// Get ChatRoomInfo properties
NSString *targetId = chatRoomInfo.targetId;
int totalMemberCount = chatRoomInfo.totalMemberCount;
NSArray<RCChatRoomMemberInfo *> *memberInfoArray = chatRoomInfo.memberInfoArray;

// Get ChatRoomMemberInfo properties
for (RCChatRoomMemberInfo *memberInfo in memberInfoArray) {
NSString *userId = memberInfo.userId;
long long joinTime = memberInfo.joinTime;

// TODO
}
}
error:^(RCErrorCode status) {
// Handle error
}];
ParameterTypeDescription
targetIdNSStringThe chatroom ID. The maximum valid length is 64 characters.
countintThe number of chatroom members to retrieve. Range: 0-20. Due to the large number of members in chatrooms, the maximum number of members that can be retrieved is 20 to balance efficiency and user experience. If count is 0, the returned chatroom information will only include the total number of members, not the specific member list.
orderRCChatRoomMemberOrderThe order in which the member list is retrieved (either the earliest or latest joined members). RC_ChatRoom_Member_Asc (1) indicates ascending order, retrieving members from the earliest joined in ascending order of join time; RC_ChatRoom_Member_Desc (2) indicates descending order, retrieving members from the latest joined in descending order of join time.
successBlockBlockCallback for successful retrieval. Returns RCChatRoomInfo, which contains the chatroom member list as requested. See the RCChatRoomInfo Class Description below for details.
errorBlockBlockCallback for failure. status returns the error code RCErrorCode.
  • RCChatRoomInfo Class Description:

    ParameterTypeDescription
    targetIdNSStringChatroom information
    memberOrderRCChatRoomMemberOrderThe order in which the member list is retrieved
    memberInfoArrayNSArrayChatroom member list, where each element is a chatroom member object RCChatRoomMemberInfo, containing the user ID (userId) and the join time (joinTime) in Unix timestamp format, in milliseconds. The members in the list are ordered from oldest to newest by join time.
    totalMemberCountintThe total number of members in the current chatroom