From fdbf508bbf329bb5b4876cf13c579b2d22715307 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 22 Jan 2020 21:17:10 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D1=83=D0=B5=D0=BC=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB=20WSS=20=D0=BF=D1=80=D0=B8=20=D0=BD=D0=B5=D0=BE=D0=B1?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/api/WebSocketConnection.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/api/WebSocketConnection.js b/client/api/WebSocketConnection.js index 49babb65..a3a67f2b 100644 --- a/client/api/WebSocketConnection.js +++ b/client/api/WebSocketConnection.js @@ -57,7 +57,12 @@ class WebSocketConnection { if (this.ws && this.ws.readyState == WebSocket.OPEN) { resolve(this.ws); } else { - url = url || `ws://${window.location.host}/ws`; + let protocol = 'ws:'; + if (window.location.protocol == 'https:') { + protocol = 'wss:' + } + + url = url || `${protocol}//${window.location.host}/ws`; this.ws = new WebSocket(url);