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

Merge pull request #54 from paulgreg/master

Use wss if page is hosted on https
This commit is contained in:
marzavec 2019-03-03 13:56:19 -08:00 committed by GitHub
commit 651a141b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,7 +73,13 @@ 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:'
// if you changed the port during the server config, change 'wsPath'
// to the new port (example: ':8080')
// if you are reverse proxying, change 'wsPath' to the new location
// (example: '/chat-ws')
var wsPath = ':6060';
ws = new WebSocket(protocol + '//' + document.domain + wsPath);
}
var wasConnected = false;