From a8bf27b54d6d68acf63ea772b9df5c08c9c4011d Mon Sep 17 00:00:00 2001 From: ph4z Date: Wed, 20 Oct 2021 02:38:37 +0000 Subject: [PATCH 1/5] Accept webSocketsScheme parameter on network node config --- Platform/UI/EventsServerClient.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Platform/UI/EventsServerClient.js b/Platform/UI/EventsServerClient.js index 1ae387ad4..4c4a5ef49 100644 --- a/Platform/UI/EventsServerClient.js +++ b/Platform/UI/EventsServerClient.js @@ -218,11 +218,13 @@ function newEventsServerClient(lanNetworkNode) { try { let host let port + let scheme /* At this point the node does not have the payload property yet, that is why we have to do this manually */ try { let config = JSON.parse(lanNetworkNode.config) host = config.host port = config.webSocketsPort + scheme = config.webSocketsScheme /* Check if we really have to stablish the connection. */ if (config.autoConnect === false) { return } @@ -268,7 +270,11 @@ function newEventsServerClient(lanNetworkNode) { return } - const WEB_SOCKETS_URL = 'ws://' + host + ':' + port + '' + if (scheme === undefined) { + scheme = 'ws' + } + + const WEB_SOCKETS_URL = scheme + '://' + host + ':' + port + '' WEB_SOCKETS_CONNECTION = new WebSocket(WEB_SOCKETS_URL) WEB_SOCKETS_CONNECTION.onerror = error => { From 05d77ba9aaee35a6c40c9e116473a014fddbd3b2 Mon Sep 17 00:00:00 2001 From: ph4z Date: Wed, 20 Oct 2021 03:20:58 +0000 Subject: [PATCH 2/5] Ensure task module connect to local port of event server --- Projects/Foundations/TS/Task-Modules/EventServerClient.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Projects/Foundations/TS/Task-Modules/EventServerClient.js b/Projects/Foundations/TS/Task-Modules/EventServerClient.js index add819ab3..9c1743978 100644 --- a/Projects/Foundations/TS/Task-Modules/EventServerClient.js +++ b/Projects/Foundations/TS/Task-Modules/EventServerClient.js @@ -23,10 +23,10 @@ if (host === undefined) { host = 'localhost' } - if (port === undefined) { + if (port === undefined || port !== global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) { port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT } - + let messageCounter = 0 let commandCounter = 0 @@ -202,4 +202,4 @@ } sendCommand(eventCommand, responseCallBack) } -} \ No newline at end of file +} From 2a8fe5d39b325c8dacf0e79c56c85f5f6f8fc838 Mon Sep 17 00:00:00 2001 From: ph4z Date: Wed, 20 Oct 2021 04:31:10 +0000 Subject: [PATCH 3/5] Accept webSocketsExternalURL parameter on network node config --- Platform/UI/EventsServerClient.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Platform/UI/EventsServerClient.js b/Platform/UI/EventsServerClient.js index 4c4a5ef49..e8c7caadd 100644 --- a/Platform/UI/EventsServerClient.js +++ b/Platform/UI/EventsServerClient.js @@ -218,13 +218,13 @@ function newEventsServerClient(lanNetworkNode) { try { let host let port - let scheme + let extwsurl /* At this point the node does not have the payload property yet, that is why we have to do this manually */ try { let config = JSON.parse(lanNetworkNode.config) host = config.host port = config.webSocketsPort - scheme = config.webSocketsScheme + extwsurl = config.webSocketsExternalURL /* Check if we really have to stablish the connection. */ if (config.autoConnect === false) { return } @@ -270,12 +270,12 @@ function newEventsServerClient(lanNetworkNode) { return } - if (scheme === undefined) { - scheme = 'ws' - } - - const WEB_SOCKETS_URL = scheme + '://' + host + ':' + port + '' + let wsurl = 'ws://' + host + ':' + port + '' + if (extwsurl !== undefined) { + wsurl = extwsurl + } + const WEB_SOCKETS_URL = wsurl WEB_SOCKETS_CONNECTION = new WebSocket(WEB_SOCKETS_URL) WEB_SOCKETS_CONNECTION.onerror = error => { console.log('WebSocket error:' + JSON.stringify(error)) From b46c637e7500ee211389f920723080b0ca3daedf Mon Sep 17 00:00:00 2001 From: ph4z Date: Wed, 20 Oct 2021 04:40:08 +0000 Subject: [PATCH 4/5] Revert "Ensure task module connect to local port of event server" This reverts commit 05d77ba9aaee35a6c40c9e116473a014fddbd3b2. --- Projects/Foundations/TS/Task-Modules/EventServerClient.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Projects/Foundations/TS/Task-Modules/EventServerClient.js b/Projects/Foundations/TS/Task-Modules/EventServerClient.js index 9c1743978..add819ab3 100644 --- a/Projects/Foundations/TS/Task-Modules/EventServerClient.js +++ b/Projects/Foundations/TS/Task-Modules/EventServerClient.js @@ -23,10 +23,10 @@ if (host === undefined) { host = 'localhost' } - if (port === undefined || port !== global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) { + if (port === undefined) { port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT } - + let messageCounter = 0 let commandCounter = 0 @@ -202,4 +202,4 @@ } sendCommand(eventCommand, responseCallBack) } -} +} \ No newline at end of file From a8d2a8f837803a6fa066067df19910a12f053447 Mon Sep 17 00:00:00 2001 From: ph4z Date: Wed, 20 Oct 2021 04:44:21 +0000 Subject: [PATCH 5/5] Accept webSocketsExternalURL parameter on network node config --- Platform/UI/EventsServerClient.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Platform/UI/EventsServerClient.js b/Platform/UI/EventsServerClient.js index e8c7caadd..5ec788e9b 100644 --- a/Platform/UI/EventsServerClient.js +++ b/Platform/UI/EventsServerClient.js @@ -219,7 +219,6 @@ function newEventsServerClient(lanNetworkNode) { let host let port let extwsurl - /* At this point the node does not have the payload property yet, that is why we have to do this manually */ try { let config = JSON.parse(lanNetworkNode.config) host = config.host