From 01fc3e1ef5a059b2b931ce73e13226a606902536 Mon Sep 17 00:00:00 2001 From: aPinat Date: Fri, 16 Jul 2021 21:08:16 +0000 Subject: [PATCH] Fix error connecting to unsecure WebSocket when loading over HTTPS --- src/utils/socket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/socket.js b/src/utils/socket.js index c3c1072..7f56ce6 100644 --- a/src/utils/socket.js +++ b/src/utils/socket.js @@ -34,4 +34,4 @@ class CustomSocket extends WebSocket { } } -export const socket = new CustomSocket('ws://' + location.host + '/') +export const socket = new CustomSocket((location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + '/')