diff options
author | Grégory Paul <paulgreg@gmail.com> | 2019-03-03 15:50:31 +0100 |
---|---|---|
committer | Grégory Paul <paulgreg@gmail.com> | 2019-03-03 15:50:31 +0100 |
commit | 101f20c084f6ac8b150543d87494d429f3459afa (patch) | |
tree | bf92190554ee11e818a5d560eb458aa49cd8d780 /client | |
parent | Minor bug fix due to lib change (diff) | |
download | hackchat-101f20c084f6ac8b150543d87494d429f3459afa.tar.gz hackchat-101f20c084f6ac8b150543d87494d429f3459afa.zip |
Use wss if page is hosted on https
Diffstat (limited to '')
-rw-r--r-- | client/client.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/client.js b/client/client.js index cf6a2e8..bd3d036 100644 --- a/client/client.js +++ b/client/client.js @@ -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; |