diff --git a/socialdragon/templates/index.html b/socialdragon/templates/index.html index ad8575d..0f39b87 100755 --- a/socialdragon/templates/index.html +++ b/socialdragon/templates/index.html @@ -95,7 +95,11 @@ var queue = []; var archive = []; -var exampleSocket = new WebSocket("ws://Marvins-MacBook-Pro.local:8000/ws"); +// Construct websocket url +var loc = window.location; +var ws_url = ((loc.protocol === "https:") ? "wss://" : "ws://") + loc.host + "/ws"; + +var exampleSocket = new WebSocket(ws_url); exampleSocket.onopen = function (event) { console.log("WS: Connection open"); };