Events
Polling /v1/jobs tells you when a render finished. The
Music API is different: a player changes state continuously, and you
want to know the moment a track starts rather than noticing afterwards.
GET /v1/events is a WebSocket that pushes player events to you.
Connecting
The protocol follows the base URL — wss:// for https://, ws:// for a
local http://.
Authenticate in the handshake, exactly like a normal request:
Browsers cannot set headers on a WebSocket handshake, so the key may also be
passed as ?key=. Prefer the header everywhere else — a query string ends up
in access logs.
Events
Every message is a JSON object with a type.
playerClosed.reason is idle or disconnected. botStopped carries no
guildId because it is about the bot as a whole, not one player.
The track on trackStarted is the same shape the Music API
returns — title, author, duration, artwork, and whether it is a stream.
Filtering
By default a socket receives every event. Narrow it with a comma-separated
events query parameter:
Which events you get
A socket only hears about the bot its key is linked to. A key with no bot linked receives everything — handy while you are wiring things up, but not something to rely on in production.
Keepalives
The server sends ping every 30 seconds. Clients are not required to answer,
but if you sit behind a proxy that drops idle connections, reply with pong:
Any other text a client sends is ignored.
In the SDK
The JavaScript SDK wraps all of this. Subscribing opens the socket lazily, and unsubscribing from the last event closes it again:
See SDK events for reconnect behaviour and lifecycle details.