From 7197e223d181722f6df49acb979c0d2f9f2c9551 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 21 Jan 2017 16:38:38 -0600 Subject: [PATCH] Connect to the right url no matter where we connect from --- data/web-static/js/mudsync.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/web-static/js/mudsync.js b/data/web-static/js/mudsync.js index 90f3daa..b926c14 100644 --- a/data/web-static/js/mudsync.js +++ b/data/web-static/js/mudsync.js @@ -27,9 +27,9 @@ function displayMessage(data, self_sent) { - stream_metabox.offsetHeight)) { should_scroll = true; } - document.getElementById("main-input").value = ""; if (self_sent) { new_entry.setAttribute("class", "stream-entry self-sent"); + document.getElementById("main-input").value = ""; } else { new_entry.setAttribute("class", "stream-entry"); } @@ -42,7 +42,8 @@ function displayMessage(data, self_sent) { function installWebsocket() { // TODO: Don't hardcode the websocket path; pull it from the DOM - var ws = new WebSocket("ws://127.0.0.1:8888"); + var address = "ws://".concat(window.location.hostname, ":", window.location.port); + var ws = new WebSocket(address); ws.onmessage = function(evt) { displayMessage(evt.data, false); }; -- 2.31.1