Polyv Help Center

Help Center

Get Channel Display Online Count

Updated: 2026-08-12 17:10:12

API Description

由业务服务端调用,获取指定频道当前展示在线人数;
返回值口径与监控页、端上展示人数一致(在线列表人数 + 列表外虚拟人数 factor)。
接口支持 HTTPS 协议。

API URL

https://api.polyv.net/live/v5/chat/redirect/channel/online-user-count/get

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS; HTTPS is recommended for security.
  2. displayCount is the display online count, equal to the total number in the online list plus the virtual count outside the list (factor), consistent with the monitoring page and client display.
  3. dummyCount is the virtual count within the list; realCount is the real online count (total list count minus virtual count within the list).
  4. This API differs from the legacy API "Get Channel Chat Room Online Count" (/live/v3/channel/chat/count-online-user): this API additionally distinguishes between real and virtual counts and returns the display count including virtual additions.

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret used to generate the signature is critical for communication data security. It must not be used directly on the client. All APIs must be called through the customer's own server to relay to the POLYV server for response data. See Signature Generation Rules
roomId true String(1,100) Channel ID (query parameter)

Example

Request Example:

GET https://api.polyv.net/live/v5/chat/redirect/channel/online-user-count/get?roomId=412738

Response JSON (Success):

{
  "code": 200,
  "status": "success",
  "message": "获取成功",
  "data": {
    "displayCount": 10000,
    "dummyCount": 3000,
    "realCount": 1
  }
}

Response Parameter Description

Parameter Type Description
code Integer 200 indicates success; 400 mostly indicates parameter validation failure; 500 mostly indicates business error or server exception
status String success / fail / error
message String e.g., "Successfully retrieved" or specific error description
data Object Count details, see table below

data Fields

Parameter Type Description
displayCount Number Display online count (list count + virtual count outside list factor), consistent with monitoring page/client display
dummyCount Number Virtual count within the list
realCount Number Real online count

Error Examples

Parameter Validation Failure:

{
  "code": 400,
  "status": "fail",
  "message": "缺少参数roomId"
}

Channel and Account Mismatch:

{
  "code": 400,
  "status": "fail",
  "message": "roomId非法"
}

Missing Account Authentication Information:

{
  "code": 400,
  "status": "fail",
  "message": "accountId is required"
}

Server Exception:

{
  "code": 500,
  "status": "error",
  "message": "获取在线人数失败"
}

(The specific message depends on the actual error message.)

联系客服,在线咨询