Skip to main content

Connecting

Open a WebSocket connection to one of the available endpoints:
The /ws/v1/user endpoint requires per-message authentication. See User orders for details. On a successful connection, the server sends a connected message:

Message format

All messages are JSON. The server may batch multiple JSON objects into a single WebSocket frame separated by newlines (\n). Clients must split on newlines before parsing each line:

Client messages

Messages sent from the client to the server follow this structure:
Only include the fields relevant to the channel you are using. The type field is always required.

Server messages

Messages sent from the server to the client:

Subscribing and unsubscribing

Subscribe to a channel by sending a subscribe message with the required fields:
Unsubscribe by sending an unsubscribe message with the room name:
The server confirms with an unsubscribed message:

Room naming

Room names are constructed from the channel and subscription parameters:

Keepalive

The server sends WebSocket-level ping frames every ~54 seconds. Most WebSocket libraries handle pong replies automatically. You can also send an application-level ping to verify the connection is alive:
The server replies with:
If the server does not receive a pong within 60 seconds, the connection is closed. Ensure your client handles WebSocket ping/pong frames.

Reconnection

Connections can drop due to network issues, server restarts, or idle timeouts. Implement reconnection with exponential backoff:

Limits

WebSocket upgrades are rate-limited per IP.