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:
parent
1a4844cee1
commit
2d1347eee3
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue