diff options
-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); }; |