Some WebSocket best practices are:
Remember WebSocket rate limits.
Spread subscriptions over more than one WebSocket client connection. For example, do not subscribe to BTC-USD and ETH-USD on the same channel if possible. Instead, open up two separate WebSocket connections to help load balance those inbound messages across separate connections.
Connected clients should increase their web socket receive buffer to the largest configurable amount possible (given any client library or infrastructure limitations), due to the potential volume of data for any given product.
Use alternative batch channels (such as
ticker) which deliver a batched version of the respective data on a set interval reducing overall traffic.
heartbeatschannel to keep your connection alive. Subscribing to the heartbeats channel alongside other channels ensures that all subscriptions remain open. This is useful, for example, when fetching marketdata for illiquid pairs.
Was this helpful?