fix(realtime): terminate failed sockets

This commit is contained in:
Federico Jaramillo Martinez
2026-07-18 08:33:51 +02:00
parent c569a03f54
commit 65350fd1b5
2 changed files with 14 additions and 2 deletions
+6
View File
@@ -5,6 +5,7 @@ export interface RealtimeSocket {
readonly OPEN: number;
readyState: number;
send(payload: string): void;
terminate(): void;
on(event: "close", listener: () => void): unknown;
}
@@ -64,6 +65,11 @@ export class SessionEventHub {
socket.send(payload);
} catch {
sockets.delete(socket);
try {
socket.terminate();
} catch {
// Removal is authoritative; cleanup failure must not block healthy sockets.
}
}
}
}