RLG-Web client: determine the host for WebSocket connections.
Construct the URLs for WebSocket connections using window.location.host instead of hardcoding them.
This commit is contained in:
parent
1ef1b16014
commit
185ea6a9ef
1 changed files with 2 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue