Kana Perps Websocket API
Overview of supported trading markets and installation prerequisites for using the Websocket API.
Last updated
import WebSocket from 'ws';
const marketId = 'your_market_id';
const ws = new WebSocket(`wss://perps-sdk-ws.kanalabs.io/wsOrderBook?marketId=${marketId}`);
ws.on('open', () => {
console.log('[client] Connected to the server');
ws.send('Request data from endpoint');
});
ws.on('message', (data) => {
console.log(`Received a message from the server:, ${data}`);
});
ws.on('close', () => {
console.log('[client] Disconnected from the server');
});