Skip to main content

Query Room Participants and Resources

Query RTC room information, including:

  • RTC room ID, session ID (sessionId), and creation time.
  • List of RTC room participants.
  • Audio/video stream resources published by participants.
  • Live streaming audience count and user IDs.

Request Method

POST: https://data center domain/rtc/room/query.json

Signature Rules: All requests to RC server APIs require signature verification. See API Request Signature for details.

Request Body Parameters

The HTTP request body contains a JSON object with the following structure:

ParameterTypeRequiredDescription
roomIdStringYesThe RTC room ID to query

Request Example

POST /rtc/room/query.json HTTP/1.1
Host: api.rong-api.com
App-Key: uwd1c0sxdlx2
Timestamp: 1585127132438
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Room-Id: room1
Content-Type: application/json

{
"roomId":"room1"
}

Response

The HTTP response body contains a JSON object with the following structure:

FieldTypeDescription
codeNumberBusiness status code. 200 indicates success. See Status Codes for details.
roomIdStringCurrent RTC room ID
sessionIdStringCurrent RTC session ID.

The session ID can also be obtained through RC server callbacks. See Room Status Callback.
createTimeNumberRoom creation timestamp in milliseconds since January 1, 1970 00:00:00 UTC
membersArrayParticipant and resource information. Note: For live streaming rooms, the members object only contains host information.
members[i].userIdStringUser ID
members[i].joinTimeNumberParticipant join timestamp in milliseconds since January 1, 1970 00:00:00 UTC
members[i].dataObjectPublished resource information
members[i].data.urisArrayList of resource URIs (see details below)
members[i].data.uris[i].mediaTypeNumberResource type. 0: Audio; 1: Video.
members[i].data.uris[i].msidStringStream ID
members[i].data.uris[i].uriStringGlobally unique resource URI (format irrelevant)
members[i].data.uris[i].tagStringClient-specified stream tag. Default tag is RongCloudRTC.
members[i].data.uris[i].stateNumberResource state. 0: Disabled; 1: Enabled.
totalNumberTotal audience count in live streaming rooms (only valid for live mode)
viewsArrayList of audience user IDs in live streaming rooms (only valid for live mode)

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code":200,
"roomId":"444",
"sessionId":"cRZTAOjBsS8gUZLrTTIO_A",
"createTime":1585043771361,
"members":[
{
"userId":"13811223344_h0fc_web",
"joinTime":1585043771362,
"data":{
"uris":[
{
"mediaType":0,
"msid":"13811223344_h0fc_web_RongCloudRTC",
"uri":"{\"clusterId\":\"rtc-data-dev-rtc40-15-bdcbj.rongcloud.net\",\"serverId\":\"172.24.151.15:9005\",\"resourceId\":\"13811223344_h0fc_web_RongCloudRTC_0\",\"connectionId\":\"AAY2NjM0NjMAFDEzODExMjIzMzQ0X2gwZmNfd2ViAAM0NDQA\",\"ssrc\":2750434140,\"serviceProvider\":\"awsnx\",\"userTimestamp\":1585043802893}",
"tag":"RongCloudRTC",
"state":1
},
{
"mediaType":1,
"msid":"13811223344_h0fc_web_RongCloudRTC",
"uri":"{\"clusterId\":\"rtc-data-dev-rtc40-15-bdcbj.rongcloud.net\",\"serverId\":\"172.24.151.15:9005\",\"resourceId\":\"13811223344_h0fc_web_RongCloudRTC_1\",\"connectionId\":\"AAY2NjM0NjMAFDEzODExMjIzMzQ0X2gwZmNfd2ViAAM0NDQA\",\"ssrc\":1782111418,\"serviceProvider\":\"awsnx\",\"userTimestamp\":1585043802893}",
"tag":"RongCloudRTC",
"state":1
}
]
}
}
]
}