diff options
author | Mateusz Gapski <mateuszx.gapski@intel.com> | 2020-07-24 09:52:53 +0300 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2020-07-28 20:45:07 +0300 |
commit | 33a8c5369e0253a93dba2e70647bda1c7697b73b (patch) | |
tree | 12f2c68f40527b9257309a965168af9364a93c63 | |
parent | 37b0839703ffce0ca31aafc426852f706b101c46 (diff) | |
download | webui-vue-33a8c5369e0253a93dba2e70647bda1c7697b73b.tar.xz |
Add the possibility to disable subscribe socket
Intel does not support subscribe socket yet.
I don't want to try to connect with this socket
becuase it crashes entire app in development mode.
Signed-off-by: Mateusz Gapski <mateuszx.gapski@intel.com>
Change-Id: I09d66474480dcb37393ecff5d46c4ee0e9052f99
-rw-r--r-- | .env.intel | 1 | ||||
-rw-r--r-- | src/store/plugins/WebSocketPlugin.js | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -1,3 +1,4 @@ NODE_ENV=production VUE_APP_ENV_NAME="intel" VUE_APP_COMPANY_NAME="intel" +VUE_APP_SUBSCRIBE_SOCKET_DISABLED="true"
\ No newline at end of file diff --git a/src/store/plugins/WebSocketPlugin.js b/src/store/plugins/WebSocketPlugin.js index 400fdefa..cf034f7a 100644 --- a/src/store/plugins/WebSocketPlugin.js +++ b/src/store/plugins/WebSocketPlugin.js @@ -20,11 +20,18 @@ const WebSocketPlugin = store => { }; const initWebSocket = () => { + const socketDisabled = + process.env.VUE_APP_SUBSCRIBE_SOCKET_DISABLED === 'true' ? true : false; + if (socketDisabled) return; const token = store.getters['authentication/token']; ws = new WebSocket(`wss://${window.location.host}/subscribe`, [token]); ws.onopen = () => { ws.send(JSON.stringify(data)); }; + ws.on('error', function(err) { + console.error('error!'); + console.error(err.code); + }); ws.onerror = event => { console.error(event); }; |