From b166afc3bcb6c82e1ac2dce8cf3ce1e37f6916cd Mon Sep 17 00:00:00 2001 From: Ben West Date: Sat, 21 Oct 2023 14:58:59 -0700 Subject: [PATCH 1/3] socket.io: enable legacy v2 connections The allowEIO3, when set to true allows v2 clients to connect while the default is false. This patch should allow versions of AndroidAPS older than 3.2 to connect to NS15 and above. Thanks to Dave Carlson for researching and experimenting with this option! https://socket.io/docs/v4/migrating-from-2-x-to-3-0/#how-to-upgrade-an-existing-production-deployment https://socket.io/docs/v4/server-options/#alloweio3 --- lib/server/websocket.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/server/websocket.js b/lib/server/websocket.js index 2924db0554d..d69999ce856 100644 --- a/lib/server/websocket.js +++ b/lib/server/websocket.js @@ -72,6 +72,7 @@ function init (env, ctx, server) { function start () { io = require('socket.io')({ + allowEIO3: true, 'log level': 0 }).listen(server, { //these only effect the socket.io.js file that is sent to the client, but better than nothing From 40dc7b03c159f66a305bcafbe6b70c438fd9c745 Mon Sep 17 00:00:00 2001 From: Dave Carlson Date: Sat, 21 Oct 2023 13:11:19 -0700 Subject: [PATCH 2/3] restore compat with socket.io v2 client --- lib/server/websocket.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/server/websocket.js b/lib/server/websocket.js index d69999ce856..07e3b11edc0 100644 --- a/lib/server/websocket.js +++ b/lib/server/websocket.js @@ -76,7 +76,9 @@ function init (env, ctx, server) { 'log level': 0 }).listen(server, { //these only effect the socket.io.js file that is sent to the client, but better than nothing - 'browser client minification': true + // compat with v2 client + allowEIO3: true + , 'browser client minification': true , 'browser client etag': true , 'browser client gzip': false , 'perMessageDeflate': { From 19be01d2c0b9237ca5a37dedf1185fa72fcc386e Mon Sep 17 00:00:00 2001 From: Ben West Date: Sat, 21 Oct 2023 17:41:41 -0700 Subject: [PATCH 3/3] socket.io prefer version from @thecubic This patch removes my own patch to enable allowEIO3 in favor of @thecubic's patch. They both do the same thing, but @thecubic's is tested. --- lib/server/websocket.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/server/websocket.js b/lib/server/websocket.js index 07e3b11edc0..95da7d906ce 100644 --- a/lib/server/websocket.js +++ b/lib/server/websocket.js @@ -72,7 +72,6 @@ function init (env, ctx, server) { function start () { io = require('socket.io')({ - allowEIO3: true, 'log level': 0 }).listen(server, { //these only effect the socket.io.js file that is sent to the client, but better than nothing