send Client messages

Every client message is a JSON object with an op field that selects the action. Unrecognized messages are ignored, except a second auth, which is a protocol error that closes the connection.

Authenticateauth

Authenticate a connection that did not send an Authorization header.

FieldTypeDescription
oprequiredobject
tokenrequiredstring

A session token, guest token, or API key.

Subscribesubscribe

FieldTypeDescription
oprequiredobject
topicrequiredstring

The topic to subscribe to. chat: one channel's live chat; requires channel. user: your own direct messages and friend activity. events: your own channel's event feed.

channelstring

The channel id to subscribe to. Required for chat and ignored for other topics.

Unsubscribeunsubscribe

FieldTypeDescription
oprequiredobject
topicrequiredstring
channelstring

The channel to leave. Required for chat.

Send a chat messagechat.send

FieldTypeDescription
oprequiredobject
channelrequiredstring
textrequiredstring

The message text. Escape it when rendering as HTML.

reply_parent_msg_idstring <uuid>

The message being replied to. Optional. Must belong to the same channel, otherwise the send is rejected.