From a8bf27b54d6d68acf63ea772b9df5c08c9c4011d Mon Sep 17 00:00:00 2001 From: ph4z Date: Wed, 20 Oct 2021 02:38:37 +0000 Subject: [PATCH] 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 => {