Skip to content

Commit

Permalink
Removed mapping to ws on socket io client connection (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonKirill authored Dec 4, 2024
1 parent 1777ec2 commit aca3995
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions chat_client/static/js/sio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let socket;
const sioTriggeringEvents = ['configLoaded', 'configNanoLoaded'];

sioTriggeringEvents.forEach(event=>{
document.addEventListener(event,(e)=>{
document.addEventListener(event,_=>{
socket = initSIO();
});
});
Expand All @@ -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();
Expand Down

0 comments on commit aca3995

Please sign in to comment.