Don't hardcode port for websocket url

This commit is contained in:
sm
2015-08-26 19:58:59 -07:00
parent 6859c9418d
commit b633898ef4
+5 -1
View File
@@ -28,7 +28,11 @@ $(function(){
function setupWS() {
a = document.createElement("a");
a.href = document.URL;
url = "ws://" + a.hostname + ":8000/ws/";
url = "ws://" + a.hostname;
if (a.port) {
url = url + ":" + a.port;
}
url = url + "/ws/";
websocket = new WebSocket(url);
websocket.onopen = function(evt) { onOpen(evt) };
websocket.onclose = function(evt) { onClose(evt) };