你可以使用此接口查询用户的在线状态。
你可以通过QueryOnlineStatus接口,指定 AppId 和 UserId,查询指定用户的在线状态。
关于调用接口的服务地址、通信协议、字符编码和签名机制,参看调用 OpenAPI。
QPS 不得超过 100。
使用 POST 方式发起请求。
| 参数名 | 类型 | 必填 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | QueryOnlineStatus | 接口名称,本接口取值:QueryOnlineStatus |
| Version | String | 是 | 2020-12-01 | 接口版本,本接口取值:2020-12-01 |
| 参数名 | 类型 | 必填 | 示例值 | 描述 |
|---|---|---|---|---|
| AppId | Int | 是 | 000000 | 应用的唯一标志 |
| UserIds | Array of Int | 是 | [10001] | 查询用户的 UserId。一次最多查询 100 个成员。 |
https://rtc.volcengineapi.com?Action=QueryOnlineStatus&Version=2020-12-01
postscript{
"AppId":000000,
"UserIds":[10001]
}
json返回结果参看 BaseResponse。
其中 Result 的结构如下:
| 参数名 | 类型 | 描述 |
|---|---|---|
| AppId | Int | 应用的唯一标志 |
| QueryOnlineStatusResults | map<String, Array> | 用户在线状态,key 为在线用户的 UserId,value 为在线用户的具体状态,具体参看QueryOnlineStatus。 |
QueryOnlineStatus
| 参数名 | 类型 | 描述 |
|---|---|---|
| ConnId | String | 连接的唯一标识 |
| UserId | Int | 用户的 UserId |
| DeviceId | Int | 设备 ID |
| ClientVersion | Int | 客户端版本号 |
| Platform | String | 设备平台,目前支持 Android、iOS和 Web。 |
{
"ResponseMetadata": {
"RequestId": "Your_RequestId",
"Action": "QueryOnlineStatus",
"Version": "2020-12-01",
"Service": "rtc",
"Region": "cn-north-1"
},
"Result": {
"AppId": 000000,
"QueryOnlineStatusResults": {
"10001": [
{
"ConnId": "ConnID_1",
"UserId": 10001,
"DeviceId": 10001,
"ClientVersion": 1,
"Platform": "Android"
},
{
"ConnId": "ConnID_2",
"UserId": 10001,
"DeviceId": 10001,
"ClientVersion": 0,
"Platform": "Web"
}
]
}
}
}
json