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);
|
setConnected(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
subscribed.current = false;
|
subscribed.current = false;
|
||||||
// Subscribe
|
// Subscribe — Hyperliquid WebSocket uses "method" not "type"
|
||||||
ws.send(JSON.stringify({ type: "subscribe", subscription: { type: "l2Book", coin } }));
|
ws.send(JSON.stringify({ method: "subscribe", subscription: { type: "l2Book", coin } }));
|
||||||
ws.send(JSON.stringify({ type: "subscribe", subscription: { type: "trades", coin } }));
|
ws.send(JSON.stringify({ method: "subscribe", subscription: { type: "trades", coin } }));
|
||||||
subscribed.current = true;
|
subscribed.current = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user