From 356b337e5a6f6697edccc22d69a979d6c7894c90 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Wed, 27 Aug 2025 15:30:04 -0500 Subject: [PATCH 1/2] fix for #3380, socket.io timeout closure --- 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 27d004500b..e07f89a1e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Thanks to: @dathbe. - [calendar] Fixed broken unittest that only broke on the 1st of July and 1st of january (#3830) - [clock] Fixed missing icons when no other modules with icons is loaded (#3834) - [weather] Fixed handling of empty values in weathergov providers handling of precipitationAmount (#3859) +- [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 95fd2b8247..be48bce039 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 //add + pingTimeout: 120000 // wait up to 2 mins for client pong //add }); server.on("connection", (socket) => { diff --git a/js/socketclient.js b/js/socketclient.js index d8408e9e93..262bd3925a 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 // add + pingTimeout: 120000 // wait up to 2 mins for a pong // add }); let notificationCallback = function () {}; From fa14837326b4e1a283faa99896a5b97c49632e80 Mon Sep 17 00:00:00 2001 From: sam detweiler Date: Thu, 28 Aug 2025 10:18:41 -0500 Subject: [PATCH 2/2] cleanup comments --- js/server.js | 4 ++-- js/socketclient.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/server.js b/js/server.js index be48bce039..3b4e25031f 100644 --- a/js/server.js +++ b/js/server.js @@ -43,8 +43,8 @@ function Server (config) { credentials: true }, allowEIO3: true, - pingInterval: 120000, // server → client ping every 2 mins //add - pingTimeout: 120000 // wait up to 2 mins for client pong //add + 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 262bd3925a..73fdbf08a9 100644 --- a/js/socketclient.js +++ b/js/socketclient.js @@ -14,8 +14,8 @@ const MMSocket = function (moduleName) { } this.socket = io(`/${this.moduleName}`, { path: `${base}socket.io`, - pingInterval: 120000, // send pings every 2 mins // add - pingTimeout: 120000 // wait up to 2 mins for a pong // add + pingInterval: 120000, // send pings every 2 mins + pingTimeout: 120000 // wait up to 2 mins for a pong }); let notificationCallback = function () {};