summaryrefslogtreecommitdiff
path: root/src/store/plugins/WebSocketPlugin.js
diff options
context:
space:
mode:
authorMateusz Gapski <mateuszx.gapski@intel.com>2020-07-24 09:52:53 +0300
committerGunnar Mills <gmills@us.ibm.com>2020-07-28 20:45:07 +0300
commit33a8c5369e0253a93dba2e70647bda1c7697b73b (patch)
tree12f2c68f40527b9257309a965168af9364a93c63 /src/store/plugins/WebSocketPlugin.js
parent37b0839703ffce0ca31aafc426852f706b101c46 (diff)
downloadwebui-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
Diffstat (limited to 'src/store/plugins/WebSocketPlugin.js')
-rw-r--r--src/store/plugins/WebSocketPlugin.js7
1 files changed, 7 insertions, 0 deletions
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);
};