Connection, Subscription & Heartbeat
Connection, Subscription & Heartbeat
Connect to 6MM WebSocket streams, subscribe to topics, keep connections alive, and process message envelopes safely.
Use WebSocket streams for market data and private user-state updates that must stay current without polling.
Connection URL
Private streams require authentication context such as a listenKey or access token as described in the private channel documentation.
Subscribe
Successful subscription acknowledgement:
Unsubscribe
Application ping
Message envelope
Public pushes use a consistent envelope:
Operational recommendations
- Generate a unique client-side
idfor every subscribe, unsubscribe, and ping request. - Treat reconnect as a new session and resubscribe to required topics.
- Validate that the returned
topicmatches the channel your service expects. - Keep message processing idempotent where private order or account events are involved.
- Log connection state changes, subscription acknowledgements, and abnormal disconnects.