1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

web: fix websocket uri when page is loaded via file://

This commit is contained in:
Steffen Vogel 2018-09-17 22:17:40 +02:00
parent 2e1805f4ac
commit 0c62ce4cf0

View file

@ -309,12 +309,17 @@ function wsUrl(endpoint)
var l = window.location;
var url = '';
if (l.protocol === 'https:')
url += 'wss://';
else
url += 'ws://';
if (l.protocol == 'file:') {
url += 'ws://localhost';
}
else {
if (l.protocol === 'https:')
url += 'wss://';
else
url += 'ws://';
url += l.hostname;
url += l.hostname;
}
if ((l.port) && (l.port != 80) && (l.port != 443))
url += ':'+ l.port;