From eb719429d4e9831d2b51b0e9cc257c68e18f9b30 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Thu, 28 Aug 2025 11:02:21 -0500 Subject: [PATCH] fix for #3380, socket.io timeout closure (#3862) socket.io times out and closes the client side socket without any callback sendSocntNotification() from the server side data is lost as the socket is closed. but the client doesn't know increase the timeout fixes #3380 --- CHANGELOG.md | 1 + js/server.js | 4 +++- js/socketclient.js | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab42df7..79a9ee8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Thanks to: @dathbe. - [weather] Fixed handling of empty values in weathergov providers handling of precipitationAmount (#3859) - [calendar] Fix regression handling of limit days (#3840) - [calendar] Fixed regression of calendarfetcherutils.shouldEventBeExcluded (#3841) +- [core] Fixed socket.io timeout when server is slow to send notification, notification lost at client (#3380) ## [2.32.0] - 2025-07-01 diff --git a/js/server.js b/js/server.js index 95fd2b82..3b4e2503 100644 --- a/js/server.js +++ b/js/server.js @@ -42,7 +42,9 @@ function Server (config) { origin: /.*$/, credentials: true }, - allowEIO3: true + allowEIO3: true, + pingInterval: 120000, // server → client ping every 2 mins + pingTimeout: 120000 // wait up to 2 mins for client pong }); server.on("connection", (socket) => { diff --git a/js/socketclient.js b/js/socketclient.js index d8408e9e..73fdbf08 100644 --- a/js/socketclient.js +++ b/js/socketclient.js @@ -13,7 +13,9 @@ const MMSocket = function (moduleName) { base = config.basePath; } this.socket = io(`/${this.moduleName}`, { - path: `${base}socket.io` + path: `${base}socket.io`, + pingInterval: 120000, // send pings every 2 mins + pingTimeout: 120000 // wait up to 2 mins for a pong }); let notificationCallback = function () {};