Skip to content

WebSocket API Reference

This document is a description of how messages work over the PubSub WebSocket and an index of defined message categories.

The WebSocket sends messages to you, which we call events, and you can send messages to it, which we call requests. All messages are JSON-stringified objects, except ping and pong.

Events

All events include these fields:

json
{
  "domain": "string",
  "type": "string",
  "timestamp": 1788293099286
  // OPTIONAL: "payload": ...
}

timestamp is the Unix time in milliseconds.

domain is the highest level differentiator and indicates what subscription topic this event is from.

type indicates the unique type of event being sent. Note that type is only guaranteed to be unique within a domain, so an effective unique key would depend on both fields.

payload is an optional field containing extra information about the event. The combination of domain and type determine if this exists and what it is.

Refer to each domain's documentation for lists of types and their payloads:

  • direct - info sent directly to your specific socket connection (i.e. responses to requests)
  • pub - public information available on any session
  • prv - private session information available to its streamer and moderators

Requests

All requests must use these fields:

json
{
  "action": "string"
  // OPTIONAL: "data": ...
}

action indicates the unique type of request being sent.

data is an optional field containing extra information about the request. The action determines if this exists and what it is.

See Requests for the available actions.

Schemas

Types used by more than one payload are documented once in the schema reference. Wherever a payload shows a named type you can expand it in place, or follow it there.