commit 73d4f687bfe9d52cd602cfdec9743ea715e9dc95 (patch)
parent b5a81c738a18016bb70f823467c6c028dd8dde45
Author: Alex Karle <alex@karle.co>
Date: Sat, 25 Apr 2020 16:16:15 -0400
public/debug.html: Get server from URL, not localhost
Previously, the debug page contacted the localhost for websocket, every
time. This breaks down if you want to use the debug page with a server
that is NOT your localhost (i.e. euchre.live)
Props to ~ckarle for finding out about window.location.host
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/public/debug.html b/public/debug.html
@@ -12,7 +12,8 @@
<body>
<div id="content"></div>
<script>
- var ws = new WebSocket('ws://localhost:3000/play');
+ var host = window.location.host
+ var ws = new WebSocket('ws://' + host + '/play');
var GAME_PHASE = ''
ws.onmessage = function (event) {
msg = JSON.parse(event.data);