chore(gateway): log pre-hello ws closures

This commit is contained in:
Peter Steinberger
2025-12-10 16:58:56 +00:00
parent 93a5784c58
commit 27ad3b917f

View File

@@ -499,6 +499,11 @@ export async function startGatewayServer(
close();
});
socket.once("close", (code, reason) => {
if (!client) {
logWarn(
`gateway/ws closed before hello conn=${connId} remote=${remoteAddr ?? "?"} code=${code ?? "n/a"} reason=${reason?.toString() || "n/a"}`,
);
}
if (client && isWebchatHello(client.hello)) {
logInfo(
`webchat disconnected code=${code} reason=${reason?.toString() || "n/a"} conn=${connId}`,
@@ -529,7 +534,12 @@ export async function startGatewayServer(
});
const handshakeTimer = setTimeout(() => {
if (!client) close();
if (!client) {
logWarn(
`gateway/ws handshake timeout conn=${connId} remote=${remoteAddr ?? "?"}`,
);
close();
}
}, HANDSHAKE_TIMEOUT_MS);
socket.on("message", async (data) => {