fix(websocket): force logout on revoked session close codes
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-03-08 19:57:11 +03:00
parent 65c20faecd
commit 84ac0c0e60

View File

@@ -256,7 +256,7 @@ export function useRealtime() {
}
};
ws.onclose = () => {
ws.onclose = (closeEvent) => {
if (heartbeatIntervalRef.current !== null) {
window.clearInterval(heartbeatIntervalRef.current);
heartbeatIntervalRef.current = null;
@@ -269,6 +269,11 @@ export function useRealtime() {
window.clearInterval(reconcileIntervalRef.current);
reconcileIntervalRef.current = null;
}
if (closeEvent.code === 4401 || closeEvent.code === 1008) {
manualCloseRef.current = true;
useAuthStore.getState().logout();
return;
}
if (manualCloseRef.current) {
return;
}