WebSocket API v1

Endpoint

  • Testnet

    • Spot: wss://testnet-gw.sodex.dev/ws/spot

    • Perps: wss://testnet-gw.sodex.dev/ws/perps

  • Mainnet

    • Spot: wss://mainnet-gw.sodex.dev/ws/spot

    • Perps: 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:

  1. Set a timer of N seconds whenever a response message is received, where N is less than 60.

  2. If the timer is triggered, which means that no new message is received within N seconds, send the {"op":"ping"} as request.

  3. Expect a {"op":"pong"} as a response. If the response message is not received within N seconds, 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

Last updated