WebSocket API v1
Endpoint
Testnet
Spot:
wss://testnet-gw.sodex.dev/ws/spotPerps:
wss://testnet-gw.sodex.dev/ws/perps
Mainnet
Spot:
wss://mainnet-gw.sodex.dev/ws/spotPerps:
wss://mainnet-gw.sodex.dev/ws/perps
Rate limits
For the full REST and WebSocket limit table, see API Rate Limits.
Connection
If there’s a network problem, the system will automatically disable the connection.
The connection will break automatically if the subscription is not established or data has not been pushed for more than 60 seconds.
To keep the connection stable:
Set a timer of
Nseconds whenever a response message is received, whereNis less than60.If the timer is triggered, which means that no new message is received within
Nseconds, send the{"op":"ping"}as request.Expect a
{"op":"pong"}as a response. If the response message is not received withinNseconds, please raise an error or reconnect.
Data Streams
To subscribe to specific data feeds, you need to send a subscription message. The subscription message format is as follows:
The subscription object contains the details of the specific feed you want to subscribe to.
To unsubscribe from a specific data feed on the Sodex WebSocket API, you need to send an unsubscribe message with the following format:
The params object should match the original subscription message that was sent when subscribing to the feed. This allows the server to identify the specific feed you want to unsubscribe from. By sending this unsubscribe message, you inform the server to stop sending further updates for the specified feed.
Please note that unsubscribing from a specific feed does not affect other subscriptions you may have active at that time. To unsubscribe from multiple feeds, you can send multiple unsubscribe messages, each with the appropriate subscription details.
User-specific streams do not require subscription authorization. Any client may subscribe to another user's data, and API key authentication is not required for these subscriptions.
Data type definitions
see Schema
Available Data Streams
Mark Price Stream (perps only)
All Mark Prices Stream (perps only)
Last updated