mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix: stop WS reconnect loop on auth rejection (code 1008)
When the server closes WebSocket with 1008 (invalid token), the client no longer retries — eliminates log spam from stale sessions.
This commit is contained in:
@@ -116,6 +116,12 @@ export function WebSocketProvider({ children }: { children: React.ReactNode }) {
|
|||||||
pingIntervalRef.current = null;
|
pingIntervalRef.current = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't reconnect on auth failures (1008 = Policy Violation / invalid token)
|
||||||
|
if (event.code === 1008) {
|
||||||
|
if (isDev) console.log('[WS] Auth rejected, not reconnecting');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to reconnect if not closed intentionally
|
// Attempt to reconnect if not closed intentionally
|
||||||
if (event.code !== 1000 && reconnectAttemptsRef.current < maxReconnectAttempts) {
|
if (event.code !== 1000 && reconnectAttemptsRef.current < maxReconnectAttempts) {
|
||||||
const delay = Math.min(
|
const delay = Math.min(
|
||||||
|
|||||||
Reference in New Issue
Block a user