Commit 46df9066 authored by Sam Rushing's avatar Sam Rushing

compute websocket uri

parent e1893f08
......@@ -7,7 +7,17 @@ function message (msg) {
}
if (window["WebSocket"]) {
connection = new WebSocket("ws://dark.nightmare.com:9001/sketch")
// build the websocket uri from this document's location.
var loc = window.location, ws_uri;
if (loc.protocol === "https:") {
ws_uri = "wss:";
} else {
ws_uri = "ws:";
}
ws_uri += "//" + loc.host;
connection = new WebSocket(ws_uri + "/sketch");
connection.onopen = function () {
message ('connected')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment