From aca399543722a12ad774c51915b97eb4d0d9f6cd Mon Sep 17 00:00:00 2001 From: NeonKirill <74428618+NeonKirill@users.noreply.github.com> Date: Wed, 4 Dec 2024 22:54:29 +0100 Subject: [PATCH] Removed mapping to ws on socket io client connection (#111) --- chat_client/static/js/sio.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/chat_client/static/js/sio.js b/chat_client/static/js/sio.js index a34937cb..8d2059a0 100644 --- a/chat_client/static/js/sio.js +++ b/chat_client/static/js/sio.js @@ -3,7 +3,7 @@ let socket; const sioTriggeringEvents = ['configLoaded', 'configNanoLoaded']; sioTriggeringEvents.forEach(event=>{ - document.addEventListener(event,(e)=>{ + document.addEventListener(event,_=>{ socket = initSIO(); }); }); @@ -14,10 +14,16 @@ sioTriggeringEvents.forEach(event=>{ */ function initSIO(){ - const sioServerURL = configData['CHAT_SERVER_URL_BASE'].replace("http", 'ws'); - const socket = io(sioServerURL, {extraHeaders: { - "session": getSessionToken() - }}); + const sioServerURL = configData['CHAT_SERVER_URL_BASE']; + + const socket = io( + sioServerURL, + { + extraHeaders: { + "session": getSessionToken() + } + } + ); socket.__proto__.emitAuthorized = (event, data) => { socket.io.opts.extraHeaders.session = getSessionToken();