// Connect to WebSocket
const ws = new WebSocket("wss://api.hypercall.io/ws?wallet=0xYourWallet");
// Subscribe to channels
ws.onopen = () => {
ws.send(JSON.stringify({ type: "Subscribe", channel: "orderbook" }));
ws.send(JSON.stringify({ type: "Subscribe", channel: "fills" }));
};
// Browsers reply to Ping frames automatically.
// Many websocket libraries, including tungstenite, do too.
// Raw socket clients must handle Ping/Pong themselves.
// Handle messages
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
console.log(`Received: ${msg.type}`);
};