From af1f8eaf76062a9fde5570097fc6a75742174d97 Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Sun, 26 Jan 2025 21:26:21 +0100 Subject: [PATCH] fix: websocket is not keep alive (#2131) --- apps/websocket/src/main.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/websocket/src/main.ts b/apps/websocket/src/main.ts index ee742c58c..f819c3dff 100644 --- a/apps/websocket/src/main.ts +++ b/apps/websocket/src/main.ts @@ -39,6 +39,14 @@ const handler = applyWSSHandler({ }); } }, + // Enable heartbeat messages to keep connection open (disabled by default) + keepAlive: { + enabled: true, + // server ping message interval in milliseconds + pingMs: 30000, + // connection is terminated if pong message is not received in this many milliseconds + pongWaitMs: 5000, + }, }); wss.on("connection", (websocket, incomingMessage) => {