It's especially confusing to try to debug this if there's still a
websocket server running at the place you're wrongly connecting to...
window.onload = function () {
// Create websocket and attach to window
- var ws = new WebSocket("ws://localhost:8889/ws");
+ var scheme = (window.location.protocol === "https:") ? "wss:" : "ws:" ;
+ var ws_uri = scheme + "//" + window.location.host + "/ws";
+ var ws = new WebSocket(ws_uri);
ws.onmessage = function(evt) {
//console.log("message received: " + evt.data);