Skip to content

Commit 356b337

Browse files
committed
fix for #3380, socket.io timeout closure
1 parent 76da0aa commit 356b337

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Thanks to: @dathbe.
3737
- [calendar] Fixed broken unittest that only broke on the 1st of July and 1st of january (#3830)
3838
- [clock] Fixed missing icons when no other modules with icons is loaded (#3834)
3939
- [weather] Fixed handling of empty values in weathergov providers handling of precipitationAmount (#3859)
40+
- [core] Fixed socket.io timeout when server is slow to send notification, notification lost at client (#3380)
4041

4142
## [2.32.0] - 2025-07-01
4243

js/server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ function Server (config) {
4242
origin: /.*$/,
4343
credentials: true
4444
},
45-
allowEIO3: true
45+
allowEIO3: true,
46+
pingInterval: 120000, // server → client ping every 2 mins //add
47+
pingTimeout: 120000 // wait up to 2 mins for client pong //add
4648
});
4749

4850
server.on("connection", (socket) => {

js/socketclient.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const MMSocket = function (moduleName) {
1313
base = config.basePath;
1414
}
1515
this.socket = io(`/${this.moduleName}`, {
16-
path: `${base}socket.io`
16+
path: `${base}socket.io`,
17+
pingInterval: 120000, // send pings every 2 mins // add
18+
pingTimeout: 120000 // wait up to 2 mins for a pong // add
1719
});
1820

1921
let notificationCallback = function () {};

0 commit comments

Comments
 (0)