aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2019-03-03 22:56:19 +0100
committerGitHub <noreply@github.com>2019-03-03 22:56:19 +0100
commit651a141b3fca6d5be404281ab67a70f267878e9d (patch)
tree02685e1a174e6738d74ce3c355538958abf7e6d6 /client
parentMinor bug fix due to lib change (diff)
parentIntroducing wsPath to update path for local installation (diff)
downloadhackchat-651a141b3fca6d5be404281ab67a70f267878e9d.tar.gz
hackchat-651a141b3fca6d5be404281ab67a70f267878e9d.zip
Merge pull request #54 from paulgreg/master
Use wss if page is hosted on https
Diffstat (limited to 'client')
-rw-r--r--client/client.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/client.js b/client/client.js
index cf6a2e8..380318e 100644
--- a/client/client.js
+++ b/client/client.js
@@ -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;