WebSocket
Real-time market data and account updates via WebSocket
Connection
wss://api.zdex.world/wsUpon connection, the server sends a welcome message:
{
"event": "connected",
"channels": ["orderbook", "trades", "ticker", "kline", "markprice"],
"symbols": ["BTCUSDT", "ETHUSDT"],
"pollIntervalMs": 2000
}Subscribe to Channels
Send a subscribe message to start receiving data:
{
"action": "subscribe",
"channel": "ticker",
"symbol": "BTCUSDT"
}Unsubscribe
{
"action": "unsubscribe",
"channel": "ticker",
"symbol": "BTCUSDT"
}Authentication (Account Data)
To receive account-specific data (balances, orders, positions), authenticate your WebSocket connection:
{
"action": "auth",
"token": "eyJhbGciOiJIUzI1NiIs..."
}Response:
{
"event": "authenticated",
"accountId": "clx...",
"subAccountId": "34696153"
}Heartbeat
Send periodic pings to keep the connection alive:
{ "action": "ping" }Response:
{ "event": "pong", "ts": 1711756800000 }Available Channels
See Channels for detailed message formats.
