wss sucks over nginx

This commit is contained in:
ajuvercr 2020-03-29 20:39:45 +02:00
parent 8f996c03d3
commit b0a278a5b1

View file

@ -91,8 +91,8 @@
const network = new vis.Network(container, data, options);
var ws = new WebSocket(`${window.location.protocol.startsWith("https") ? 'wss' : 'ws'}://${window.location.hostname}:3012`);
const secure = window.location.protocol.startsWith("https");
var ws = new WebSocket(`${secure ? 'wss' : 'ws'}://${window.location.hostname}${secure ? "/websocket" : ":3012"}`);
ws.onmessage = function (event) {
handle_event(JSON.parse(event.data));
};