Fix Hyperliquid WebSocket subscribe format: type -> method
This commit is contained in:
@@ -86,9 +86,9 @@ export function useHyperliquidWebSocket(coin: string = "BTC"): HyperliquidData {
|
||||
setConnected(true);
|
||||
setError(null);
|
||||
subscribed.current = false;
|
||||
// Subscribe
|
||||
ws.send(JSON.stringify({ type: "subscribe", subscription: { type: "l2Book", coin } }));
|
||||
ws.send(JSON.stringify({ type: "subscribe", subscription: { type: "trades", coin } }));
|
||||
// Subscribe — Hyperliquid WebSocket uses "method" not "type"
|
||||
ws.send(JSON.stringify({ method: "subscribe", subscription: { type: "l2Book", coin } }));
|
||||
ws.send(JSON.stringify({ method: "subscribe", subscription: { type: "trades", coin } }));
|
||||
subscribed.current = true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user