wss://api.raze.bot/v1/ws (or wss://ws.raze.bot, the same socket) with the same key as REST (?apiKey= from a browser, x-api-key from a server). Send JSON ops, receive JSON frames.
Ops
Frames
Every data frame repeats what it belongs to, so one handler can route frames of many subscriptions:
Route frames on
type and ignore a type you do not know; never treat it as a trade.
Subscribe on the URL
Query parameters of the upgrade URL subscribe one channel right away, with the same names as the op:subscribe ops.
Lifecycle
- Up to 200 subscriptions per socket.
- The server sends a WebSocket ping every 20 s; browsers answer it on their own.
{"op":"ping"}is an extra, application-level round trip. - Closing the socket ends every subscription on it. To resume after a drop, reconnect and subscribe again: each subscription starts with a fresh
snapshot. - While the server is at capacity, the upgrade of a new socket answers
503(server_busy,Retry-After: 30) instead of101. A browser only sees the connection fail, so reconnect with a backoff of at least 30 s. Open sockets keep running and can still subscribe.