diff --git a/htdocs/public/index.php b/htdocs/public/index.php index b913dc9..2f741f3 100755 --- a/htdocs/public/index.php +++ b/htdocs/public/index.php @@ -139,13 +139,21 @@ // host is used to create url to /heatmaps and /images (leave empty to use same host as website) options['host'] = ""; - var supportsWebSockets = 'WebSocket' in window || 'MozWebSocket' in window; - if (supportsWebSockets) { - - var wsServerUrl = ""; + if (supportsWebSockets) { + + var wsServerUrl = ""; - var wsServerUrl = 'ws://:/ws'; + var wsServerUrl = ''; + if (window.location.protocol == 'https:') { + wsServerUrl += 'wss://' + window.location.host; + } else { + wsServerUrl += 'ws://' + window.location.host; + } + if (window.location.port != '' && window.location.port != 0) { + wsServerUrl += ':' + window.location.port; + } + wsServerUrl += '/ws'; var mapElementId = 'map-container'; @@ -251,7 +259,7 @@ -