Connection
{ "method": "ping" }Responses
200
Pong
application/json
post/ws/ping
const ws = new WebSocket("wss://ws.afx.xyz/ws/dex");
ws.onopen = () => {
// Heartbeat every 30s
setInterval(() => ws.send(JSON.stringify({ method: "ping" })), 30000);
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.channel === "pong") return;
console.log("data:", msg);
};
200
Pong
{
"channel": "pong"
}{ "method": "unsubscribe", "subscription": { "type": "orderBook", "symbol": "BTCUSDC", "depth": 50 } }Responses
200
Ack
application/json
post/ws/unsubscribe
ws.send(JSON.stringify({
method: "unsubscribe",
subscription: { type: "orderBook", symbol: "BTCUSDC", depth: 50 },
}));
200
Ack
{
"method": "unsubscribe",
"success": true,
"subject": "orderBook.BTCUSDC.50"
}Last updated

