summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorAlexandr Ilenko <AIlenko@IBS.RU>2022-08-22 18:33:14 +0300
committerAlexandr Ilenko <AIlenko@IBS.RU>2022-08-30 10:45:30 +0300
commitf47ddcfeaa957dd6571b35e6ba7b761892f186db (patch)
tree4e825212486e6ce5f09c889cea316f75136e2193 /src/store
parent0444ab4658743504ddf12ddf911158aebf9037ae (diff)
downloadwebui-vue-f47ddcfeaa957dd6571b35e6ba7b761892f186db.tar.xz
[SILABMC-280] Fix: use wsS only when httpS
Diffstat (limited to 'src/store')
-rw-r--r--src/store/plugins/WebSocketPlugin.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/store/plugins/WebSocketPlugin.js b/src/store/plugins/WebSocketPlugin.js
index cbdc9329..afad6718 100644
--- a/src/store/plugins/WebSocketPlugin.js
+++ b/src/store/plugins/WebSocketPlugin.js
@@ -22,7 +22,9 @@ const WebSocketPlugin = (store) => {
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]);
+ const url = new URL('/subscribe', window.location.href);
+ url.protocol = url.protocol.replace('http', 'ws');
+ ws = new WebSocket(url, [token]);
ws.onopen = () => {
ws.send(JSON.stringify(data));
};