Browse Source

fixing ws / wss problem

Nicolas Winkler 4 years ago
parent
commit
e04764eb0b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      static/comm.js

+ 4 - 1
static/comm.js

@@ -120,7 +120,10 @@ $(function() {
         if (connection != null) {
         if (connection != null) {
             disconnect();
             disconnect();
         }
         }
-        var uri = 'ws://' + window.location.host + '/ws/';
+
+        var prot = document.location.protocol == 'https:' ? 'wss://' : 'ws://';
+
+        var uri = prot + window.location.host + '/ws/';
         connection = new WebSocket(uri);
         connection = new WebSocket(uri);
 
 
         connection.onopen = function() {
         connection.onopen = function() {