From 27ad3b917f8afb27697cbe0d6ea8aa6db6c376d2 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 10 Dec 2025 16:58:56 +0000 Subject: [PATCH] chore(gateway): log pre-hello ws closures --- src/gateway/server.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gateway/server.ts b/src/gateway/server.ts index dc2a18819..6655d0931 100644 --- a/src/gateway/server.ts +++ b/src/gateway/server.ts @@ -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) => {