notls mode fixed, refactoring
[henge/kiak.git] / host.js
diff --git a/host.js b/host.js
index 9981cc9..95d3cc6 100644 (file)
--- a/host.js
+++ b/host.js
@@ -2,9 +2,9 @@ document.title = "Strapp.io Host"
 const clients = []
 if ("WebSocket" in window) {
   document.addEventListener('DOMContentLoaded', (event) => {
-    const wsock = new WebSocket("wss://" + window.location.host + ":" +  _strapp_port)
+    const wsock = new WebSocket(`${_strapp_protocol}://${window.location.hostname}:${_strapp_port}`)
     wsock.onopen = () => {
-      console.log("Strapped to wss://" + window.location.host + ":" +  _strapp_port)
+      console.log(`Strapped to ${_strapp_protocol}://${window.location.hostname}:${_strapp_port}`)
     }
     wsock.onmessage = (evt) => {
       console.log("Incoming connection from " + evt.data)