1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Use wss if page is hosted on https

This commit is contained in:
Grégory Paul 2019-03-03 15:50:31 +01:00
parent 686f348e87
commit 101f20c084

View File

@ -73,7 +73,8 @@ function join(channel) {
ws = new WebSocket('wss://hack.chat/chat-ws');
} else {
// for local installs
ws = new WebSocket('ws://' + document.domain + ':6060');
var protocol = location.protocol === 'https:' ? 'wss:' : 'ws:'
ws = new WebSocket(protocol + '//' + document.domain + ':6060');
}
var wasConnected = false;