diff --git a/src/lib/websocket.ts b/src/lib/websocket.ts index a1ab370..d860bcf 100644 --- a/src/lib/websocket.ts +++ b/src/lib/websocket.ts @@ -59,6 +59,8 @@ export function useWebSocket() { const pingCounterRef = useRef(0) const pingSentTimestamps = useRef>(new Map()) const missedPongsRef = useRef(0) + // Compat flag for gateway versions that may not implement ping RPC. + const gatewaySupportsPingRef = useRef(true) const { connection, @@ -116,6 +118,7 @@ export function useWebSocket() { pingIntervalRef.current = setInterval(() => { if (!wsRef.current || wsRef.current.readyState !== WebSocket.OPEN || !handshakeCompleteRef.current) return + if (!gatewaySupportsPingRef.current) return // Check missed pongs if (missedPongsRef.current >= MAX_MISSED_PONGS) {