From 208d94a91b234e978b164c9680523a074e1f4d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Sun, 16 Oct 2016 15:27:27 +0200 Subject: [PATCH] Support https as websocket protocol (wss). --- openslides/core/static/js/core/base.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openslides/core/static/js/core/base.js b/openslides/core/static/js/core/base.js index f4d263298..0fd82dbf0 100644 --- a/openslides/core/static/js/core/base.js +++ b/openslides/core/static/js/core/base.js @@ -52,6 +52,13 @@ angular.module('OpenSlidesApp.core', [ var recInterval = null; $rootScope.connected = false; + var websocketProtocol; + if (location.protocol == 'https:') { + websocketProtocol = 'wss:'; + } else { + websocketProtocol = 'ws:'; + } + var websocketPath; if (REALM == 'site') { websocketPath = '/ws/site/'; @@ -73,7 +80,7 @@ angular.module('OpenSlidesApp.core', [ } }; var newConnect = function () { - socket = new WebSocket('ws://' + location.host + websocketPath); + socket = new WebSocket(websocketProtocol + '//' + location.host + websocketPath); clearInterval(recInterval); socket.onopen = function () { $rootScope.connected = true;