From de3a33d9a429c2885dd5c27cd9cd45dab9247b1d Mon Sep 17 00:00:00 2001 From: Mark de Bruijn Date: Wed, 15 May 2024 18:54:37 +0200 Subject: [PATCH] Fix: fix proxy chat --- web/js/chat.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/js/chat.js b/web/js/chat.js index c076ef3..dbcdeda 100644 --- a/web/js/chat.js +++ b/web/js/chat.js @@ -1,5 +1,6 @@ $(document).ready(function() { - const chatSocket = new WebSocket(`ws://${window.location.host}/chat`); + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + const chatSocket = new WebSocket(`${protocol}//${window.location.host}${window.location.pathname}chat`); let chatMessageCount = 0; const chatMessages = $('#chat-chatbox'); const chatMessagesCount = $('.chat-messages-count');