Skip to content

Commit

Permalink
handle any location
Browse files Browse the repository at this point in the history
  • Loading branch information
qchateau committed Sep 16, 2020
1 parent 0b7cf15 commit 891969f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,13 @@ class GameManager {
if (this.currentGame) {
this.currentGame.gameOver();
}

let location = window.location.pathname.toString();
if (location[location.length - 1] == "/") {
location = location.substring(0, -1);
}
this.currentGame = new GameEngine(
"ws://" + window.location.hostname + ":" + window.location.port + "/ws",
"ws://" + window.location.host + location + "/ws",
"canvas"
);
}
Expand Down

0 comments on commit 891969f

Please sign in to comment.