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) {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user