aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-08-04 00:28:50 +0200
committerJasper Van der Jeugt2020-08-04 00:28:50 +0200
commit4a53d8f322e0911e731915b066ee8ab0456061ed (patch)
tree3a17350e567b53a159223aab4e0718539356dcb8
parenta5b0e6716dbc97ac13624b6afae0f0cb7aa6d57b (diff)
Protocol
-rw-r--r--client/index.html6
1 files changed, 5 insertions, 1 deletions
diff --git a/client/index.html b/client/index.html
index 8e1333d..9b09840 100644
--- a/client/index.html
+++ b/client/index.html
@@ -10,12 +10,16 @@
<script type="text/JavaScript" src="$CAFP_BASE/assets/client.js"></script>
<script>
var app = Elm.Client.init({node: document.querySelector("main")});
+ var protocol = "ws:";
+ if(document.location.protocol == "https:") {
+ protocol = "wss:"
+ }
var path = document.location.pathname;
if(path.startsWith("$CAFP_BASE")) {
path = path.substr("$CAFP_BASE".length);
}
var roomId = path.split("/")[2];
- var url = "ws://" + document.location.host +
+ var url = protocol + "//" + document.location.host +
"$CAFP_BASE/rooms/" + roomId + "/events";
var socket = new WebSocket(url);
app.ports.webSocketOut.subscribe(function(message) {