Skip to content

Commit

Permalink
Support SSL web sockets
Browse files Browse the repository at this point in the history
This should make Ooui work with HTTPS

Fixes #51
  • Loading branch information
praeclarum committed Feb 1, 2018
1 parent 03f9ed2 commit 0ff69fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Ooui/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ function ooui (rootElementPath) {
var wsArgs = (rootElementPath.indexOf("?") >= 0 ? "&" : "?") +
"w=" + initialSize.width + "&h=" + initialSize.height;

socket = new WebSocket ("ws://" + document.location.host + rootElementPath + wsArgs, "ooui");
var proto = "ws";
if (location.protocol == "https:") {
proto = "wss";
}
socket = new WebSocket (proto + "://" + document.location.host + rootElementPath + wsArgs, "ooui");

socket.addEventListener ("open", function (event) {
console.log ("Web socket opened");
Expand Down

0 comments on commit 0ff69fd

Please sign in to comment.