From 06d75336ead367631a30d62bbb7ab90336de4557 Mon Sep 17 00:00:00 2001 From: Viktor Vorobev <vorobev@in.tum.de> Date: Mon, 19 Jun 2023 16:30:28 +0000 Subject: [PATCH] Merged in NRRPLT-8931-wss (pull request #50) [NRRPLT-8931] Add ws/wss parameter to config * [NRRPLT-8931] Add ws/wss parameter to config * [NRRPLT-8931] Add ws/wss parameter to config Approved-by: Sandro Weber --- src/App.js | 1 - src/config.json.sample.oidc | 1 + src/services/mqtt-client-service.js | 5 +++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index 1f878d6..5c2a462 100644 --- a/src/App.js +++ b/src/App.js @@ -14,7 +14,6 @@ class App extends React.Component { componentDidMount() { this.mqttClientService = MqttClientService.instance; - //MqttClientService.instance.connect('ws://' + window.location.hostname + ':1884'); } render() { diff --git a/src/config.json.sample.oidc b/src/config.json.sample.oidc index 08c86f8..358b94a 100644 --- a/src/config.json.sample.oidc +++ b/src/config.json.sample.oidc @@ -12,6 +12,7 @@ "mqtt": { "url": "localhost", "port": "9000", + "websocket": "ws", "topics": { "base": "nrp_simulation", "errors": "runtime_error", diff --git a/src/services/mqtt-client-service.js b/src/services/mqtt-client-service.js index 40c94d8..2f5dcfd 100644 --- a/src/services/mqtt-client-service.js +++ b/src/services/mqtt-client-service.js @@ -28,8 +28,9 @@ export default class MqttClientService extends EventEmitter { this.subTokensMap = new Map(); - // Since it's a singleton, shoud the url be defined here? - this.mqttBrokerUrl = 'ws://' + frontendConfig.mqtt.url + ':' + frontendConfig.mqtt.port; + // Since it's a- singleton, shoud the url be defined here? + const websocket_s = frontendConfig.mqtt.websocket ? frontendConfig.mqtt.websocket : 'ws'; + this.mqttBrokerUrl = websocket_s + '://' + frontendConfig.mqtt.url + ':' + frontendConfig.mqtt.port; this.connect(); } -- GitLab