Switch secure of WS connection according to secure of http connection of UI (#829)

Signed-off-by: Ivan Milošević <iva@blokovi.com>
This commit is contained in:
Ivan Milošević 2019-08-30 16:23:28 +02:00 committed by Drasko DRASKOVIC
parent 1a4844cee1
commit 2d1347eee3
1 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,11 @@ MF.log = function(msg) {
}
MF.url = function(data) {
return 'wss://' + window.location.hostname + '/ws/channels/' + data.channelid + '/messages?authorization=' + data.thingkey
var wsProtocol = 'ws';
if (window.location.protocol == 'https:') {
wsProtocol = 'wss'
}
return wsProtocol + '://' + window.location.hostname + '/ws/channels/' + data.channelid + '/messages?authorization=' + data.thingkey
}
app.ports.connectWebsocket.subscribe(function(data) {