Query Chatroom Information
To retrieve chatroom information, the following data can be returned:
- Total number of chatroom members
- A list of a specified number (up to 20) of chatroom members, including the user ID of each member 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:
const chatroomId = "<chatroom ID>"
const count = 10 // Number of room members to retrieve, maximum valid value is `20`, minimum is `0`, default is 0
const order = 1 // Order of members, `1` for ascending, `2` for descending, default is 0
RongIMLib.getChatRoomInfo(chatRoomId, {
count: count,
order: order
}).then(res => {
// Successfully retrieved chatroom information
if(res.code === 0){
console.log(res.data)
} else {
console.log(res.code, res.data)
}
})
Parameter | Type | Description |
---|---|---|
chatRoomId | string | Chatroom ID |
options.count | number | Number of member details to retrieve, range: 1 - 20. If not provided or set to the default value (0 ), the returned chatroom information will only include the total number of members, without the specific member list. |
options.order | number | Order in which to return chatroom member information. Ascending (1 ) returns the list of users who joined earliest. Descending (2 ) returns the list of users who joined latest. |