Skip to content

Statistics

stats.subscribe

Subscribe to periodic session statistics.

json
{"id":"1","method":"stats.subscribe","params":{"interval_ms":5000}}
ParamTypeDefaultDescription
interval_msu325000Emission interval in milliseconds (min: 500, max: 3600000)

stats.unsubscribe

json
{"id":"2","method":"stats.unsubscribe","params":{}}

Stats Event

json
{
  "event": "stats",
  "data": {
    "endpoints": [
      {
        "endpoint_id": "...",
        "inbound": {
          "packets": 1500,
          "bytes": 240000,
          "packets_lost": 0,
          "jitter_ms": 0.0,
          "last_received_ms_ago": 20
        },
        "outbound": {
          "packets": 1500,
          "bytes": 240000
        },
        "rtt_ms": null,
        "codec": "",
        "state": "connected"
      }
    ]
  }
}

Field Notes

FieldNotes
rtt_msRound-trip time from RTCP. null until an RTCP Receiver Report referencing the bridge's Sender Report has been received. This applies to both plain RTP and WebRTC endpoints.
codecNegotiated codec name (e.g., "opus", "PCMU"). Empty string "" means no codec has been negotiated yet.
stateOne of: new, buffering, connecting, connected, playing, paused, disconnected, finished.