Don't hardcode port for websocket url
This commit is contained in:
parent
6859c9418d
commit
b633898ef4
@ -28,7 +28,11 @@ $(function(){
|
|||||||
function setupWS() {
|
function setupWS() {
|
||||||
a = document.createElement("a");
|
a = document.createElement("a");
|
||||||
a.href = document.URL;
|
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 = new WebSocket(url);
|
||||||
websocket.onopen = function(evt) { onOpen(evt) };
|
websocket.onopen = function(evt) { onOpen(evt) };
|
||||||
websocket.onclose = function(evt) { onClose(evt) };
|
websocket.onclose = function(evt) { onClose(evt) };
|
||||||
|
Loading…
Reference in New Issue
Block a user