diff --git a/wdocs/ws.html b/wdocs/test-ws.html similarity index 72% rename from wdocs/ws.html rename to wdocs/test-ws.html index b50d720..d689f63 100644 --- a/wdocs/ws.html +++ b/wdocs/test-ws.html @@ -10,9 +10,21 @@ }; window.onload = function() { - var url = 'ws://' + location.host + '/ws'; var num_messages = 0; + // console.log(JSON.stringify(location)); + // location.host localhost:8080 localhost:8083 + // location.pathname /otr/ws.html /ws.html + + /* Remove last part of URI to determine path to Websocket in OTR */ + var url = "ws://" + location.host + "/"; + var parts = location.pathname.split('/'); + for (var i = 1; i < parts.length - 1; i++) { + url = url + parts[i] + "/"; + } + url = url + "ws"; + console.log(url); + websocket = new WebSocket(url); websocket.onopen = function(ev) { out('CONNECTED');