From 185ea6a9ef9522a22976ea72a8c5213271f9f710 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Sat, 14 Jul 2012 10:11:13 -0700 Subject: [PATCH] RLG-Web client: determine the host for WebSocket connections. Construct the URLs for WebSocket connections using window.location.host instead of hardcoding them. --- rlgterm.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rlgterm.js b/rlgterm.js index c0ccd37..2be84e0 100644 --- a/rlgterm.js +++ b/rlgterm.js @@ -75,8 +75,6 @@ var games = { } }; -var wsHost = "localhost:8080"; - var session = { /* The session id assigned by the server. */ id: null, @@ -523,7 +521,7 @@ function wsCurrent() { } if (statsock) return; - statsock = new WebSocket("ws://" + wsHost + "/status"); + statsock = new WebSocket("ws://" + window.location.host + "/status"); statsock.onmessage = function (ev) { var msg; try { @@ -742,7 +740,7 @@ function makeWatcher(n) { } function wsWatch(gamenumber) { - var sockurl = "ws://" + wsHost + "/watch/" + String(gamenumber); + var sockurl = "ws://" + window.location.host + "/watch/" + String(gamenumber); var ws = new WebSocket(sockurl); ws.onopen = function (event) { session.id = true;