Overview
WebSocket endpoints are available for real-time data streaming and as an alternative to HTTP request sending on the ChainStream exchange. The WebSocket URLs by network are:- Mainnet:
wss://realtime-dex.chainstream.io/connection/websocket
Authentication
WebSocket connections require authentication via thetoken query parameter in the URL:
If you are using our Go SDK or JavaScript SDK, authentication is built-in and handled automatically. You only need to manually append the token parameter when using native WebSocket libraries or other third-party libraries.
Connecting
To connect to the WebSocket API, you must establish a WebSocket connection to the respective URL based on your desired network, with the token parameter in the URL. Once connected, you can start sending subscription messages to receive real-time data updates.Command Line Example
Usingwscat to test the connection:
This documentation uses TypeScript for defining message types. For Python users, you can find equivalent types in our Python SDK.

