6. WebSocket
The push-only real-time channel for Market Data and Trading events.
What is FastConnect's WebSocket used for?
Receiving real-time market data (channel DATA: trades, bid/ask, foreign room...) and trading events (channel TRADING: order fills, asset changes) over a single WebSocket connection — no need for separate connections per data type like before. This is a receive-only (push-only) channel; to send orders over WebSocket, see "7. WebSocket API".
Why does my WebSocket connection keep disconnecting?
Common causes:
- Not replying with
pongwhen receivingpingfrom the server (the server sends a heartbeat every 30 seconds). - Unstable network or a firewall blocking the WebSocket connection.
Your client needs to implement its own reconnect logic and re-subscribe to topics after reconnecting.
Can I subscribe to multiple data types on the same connection?
Yes — send multiple topics in a single SUBSCRIBE message (for example, several symbols, or both channel DATA and TRADING), as long as your API Key has the corresponding scope for each topic type.