fix(websocket): force logout on revoked session close codes
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
@@ -256,7 +256,7 @@ export function useRealtime() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.onclose = () => {
|
ws.onclose = (closeEvent) => {
|
||||||
if (heartbeatIntervalRef.current !== null) {
|
if (heartbeatIntervalRef.current !== null) {
|
||||||
window.clearInterval(heartbeatIntervalRef.current);
|
window.clearInterval(heartbeatIntervalRef.current);
|
||||||
heartbeatIntervalRef.current = null;
|
heartbeatIntervalRef.current = null;
|
||||||
@@ -269,6 +269,11 @@ export function useRealtime() {
|
|||||||
window.clearInterval(reconcileIntervalRef.current);
|
window.clearInterval(reconcileIntervalRef.current);
|
||||||
reconcileIntervalRef.current = null;
|
reconcileIntervalRef.current = null;
|
||||||
}
|
}
|
||||||
|
if (closeEvent.code === 4401 || closeEvent.code === 1008) {
|
||||||
|
manualCloseRef.current = true;
|
||||||
|
useAuthStore.getState().logout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (manualCloseRef.current) {
|
if (manualCloseRef.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user