nimeet 文档中心
English

回调事件参考(101-112 / 201-203)

构建时从公开回调事件定义生成:事件码、名称、触发时机与负载字段。

由公开回调事件定义生成

版本 v1.1.0 · 更新于 2026-10-26 · 修订 1

事件信封

每次投递是一个 JSON 对象,字段由 公开接口定义(schema nimeet.callbacks v1.0.0)定义:

字段类型 / 含义
eventTypenumber — see events[].eventType
noticeIdstring — unique per delivery attempt batch
notifyMsepoch milliseconds when the event was produced
payloadobject — event specific, see events[].payload
productIdnumber — 1 = RTC
sidstring — unique session id for the event
json
{
  "eventType": 101,
  "noticeId": "ntc_01J8Z0000000000000000000AA",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_01J8Z0000000000000000000AA",
  "payload": {
    "channelName": "weekly-sync",
    "profile": "communication",
    "ts": 1771000000
  }
}

事件码全表(自动生成)

共 13 个事件,事件码与声网频道事件(101–112)及任务事件(201–203)对齐;负载字段逐项取自回调事件定义。

频道与用户事件

事件码名称触发时机
101channel_createChannel created (first participant joins or room is created).
102channel_destroyChannel destroyed (room finished / last participant left and grace elapsed).
103broadcaster_joinA broadcaster (host) joined a live channel.
104broadcaster_leaveA broadcaster left a live channel; `reason` carries the Agora leave reason.
105audience_joinAn audience member joined a live channel.
106audience_leaveAn audience member left a live channel.
107user_joinA user joined a communication channel.
108user_leaveA user left a communication channel; `reason` carries the Agora leave reason.
111role_to_broadcasterA user was promoted to broadcaster/host.
112role_to_audienceA user was demoted to audience.

任务与 Token 事件

事件码名称触发时机
201recording_state_changedCloud recording task state changed (starting/running/stopping/stopped/failed).
202streaming_state_changedBypass streaming task state changed (including idle-timeout expiry).
203token_expiringA token is close to its privilege expiry; `TOKEN_PRIVILEGE_WILL_EXPIRE_LEAD_SECONDS` lead time.

事件负载字段

101 channel_create

Channel created (first participant joins or room is created).

字段类型 / 取值
channelNamestring
profilecommunication | live
tsepoch seconds
json
{
  "eventType": 101,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "profile": "…",
    "ts": 1771000000
  }
}
102 channel_destroy

Channel destroyed (room finished / last participant left and grace elapsed).

字段类型 / 取值
channelNamestring
tsepoch seconds
json
{
  "eventType": 102,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "ts": 1771000000
  }
}
103 broadcaster_join

A broadcaster (host) joined a live channel.

字段类型 / 取值
channelNamestring
platformnumber
tsepoch seconds
uidnumber
json
{
  "eventType": 103,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "platform": 1,
    "ts": 1771000000,
    "uid": 10001
  }
}
104 broadcaster_leave

A broadcaster left a live channel; `reason` carries the Agora leave reason.

字段类型 / 取值
channelNamestring
reasonnumber
tsepoch seconds
uidnumber
json
{
  "eventType": 104,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "reason": 1,
    "ts": 1771000000,
    "uid": 10001
  }
}
105 audience_join

An audience member joined a live channel.

字段类型 / 取值
channelNamestring
platformnumber
tsepoch seconds
uidnumber
json
{
  "eventType": 105,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "platform": 1,
    "ts": 1771000000,
    "uid": 10001
  }
}
106 audience_leave

An audience member left a live channel.

字段类型 / 取值
channelNamestring
reasonnumber
tsepoch seconds
uidnumber
json
{
  "eventType": 106,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "reason": 1,
    "ts": 1771000000,
    "uid": 10001
  }
}
107 user_join

A user joined a communication channel.

字段类型 / 取值
channelNamestring
platformnumber
tsepoch seconds
uidnumber
json
{
  "eventType": 107,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "platform": 1,
    "ts": 1771000000,
    "uid": 10001
  }
}
108 user_leave

A user left a communication channel; `reason` carries the Agora leave reason.

字段类型 / 取值
channelNamestring
reasonnumber
tsepoch seconds
uidnumber
json
{
  "eventType": 108,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "reason": 1,
    "ts": 1771000000,
    "uid": 10001
  }
}
111 role_to_broadcaster

A user was promoted to broadcaster/host.

字段类型 / 取值
channelNamestring
tsepoch seconds
uidnumber
json
{
  "eventType": 111,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "ts": 1771000000,
    "uid": 10001
  }
}
112 role_to_audience

A user was demoted to audience.

字段类型 / 取值
channelNamestring
tsepoch seconds
uidnumber
json
{
  "eventType": 112,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "ts": 1771000000,
    "uid": 10001
  }
}
201 recording_state_changed

Cloud recording task state changed (starting/running/stopping/stopped/failed).

字段类型 / 取值
channelNamestring
modecomposite | individual | web
statestring
taskIdstring
tsepoch seconds
json
{
  "eventType": 201,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "mode": "…",
    "state": "running",
    "taskId": "task_…",
    "ts": 1771000000
  }
}
202 streaming_state_changed

Bypass streaming task state changed (including idle-timeout expiry).

字段类型 / 取值
channelNamestring
hlsUrlstring
rtmpUrlstring
statestring
taskIdstring
tsepoch seconds
json
{
  "eventType": 202,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "hlsUrl": "…",
    "rtmpUrl": "…",
    "state": "running",
    "taskId": "task_…",
    "ts": 1771000000
  }
}
203 token_expiring

A token is close to its privilege expiry; `TOKEN_PRIVILEGE_WILL_EXPIRE_LEAD_SECONDS` lead time.

字段类型 / 取值
channelNamestring
privilegeExpireAtepoch seconds
tsepoch seconds
uidnumber
json
{
  "eventType": 203,
  "noticeId": "ntc_…",
  "notifyMs": 1771000000000,
  "productId": 1,
  "sid": "sid_…",
  "payload": {
    "channelName": "weekly-sync",
    "privilegeExpireAt": 1771000000,
    "ts": 1771000000,
    "uid": 10001
  }
}

请求头与签名

请求头说明
Agora-SignatureHMAC-SHA1 hex of the raw body with the endpoint secret
Agora-Signature-V2HMAC-SHA256 hex of the raw body with the endpoint secret
Content-Typeapplication/json
X-Request-Iddelivery correlation id

接收方必须用原始请求体字节计算签名:先反序列化再签名会把空格/顺序差异算进去,导致校验失败。校验与重放防护的完整实现见 回调接入。

重试与成功判据

项值
最大尝试次数9
退避序列(秒)5 / 15 / 60 / 300 / 900 / 3600 / 7200 / 21600
成功判据HTTP 2xx
幂等键noticeId(重复投递保持不变)

非 2xx 视为失败并进入下一次退避;耗尽重试后投递记录保留在投递日志里,可通过控制台或 投递日志接口重放。

本页由文档构建流水线生成 · 2026-10-31 01:24:02 UTC · 文档中心 v1.1.0.

内容依据公开 API 定义.

ni-meet 是自建 RTC PaaS,媒体面基于 LiveKit(Apache-2.0),并与声网 API 兼容。