From 101f20c084f6ac8b150543d87494d429f3459afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Paul?= Date: Sun, 3 Mar 2019 15:50:31 +0100 Subject: Use wss if page is hosted on https --- client/client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1