diff --git a/mopidy_musicbox_webclient/static/js/gui.js b/mopidy_musicbox_webclient/static/js/gui.js index aaafd49..1a372f4 100644 --- a/mopidy_musicbox_webclient/static/js/gui.js +++ b/mopidy_musicbox_webclient/static/js/gui.js @@ -565,7 +565,10 @@ $(document).ready(function (event) { $(window).resize(resizeMb).resize() // Connect to server - var websocketUrl = $(document.body).data('websocket-url') + //var websocketUrl = $(document.body).data('websocket-url') + var wsProto = "https:" === window.location.protocol ? "wss://" : "ws://"; + var websocketUrl = wsProto + window.location.hostname + + window.location.pathname.replace("musicbox_webclient", "mopidy").match(/.*\//) + "ws"; var connectOptions = {callingConvention: 'by-position-or-by-name'} if (websocketUrl) { connectOptions['webSocketUrl'] = websocketUrl