Skip to content

Commit

Permalink
Hacked import of cookie to prevent undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaPolit committed Jan 30, 2025
1 parent 13b8c12 commit 850aa9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/api/socketio/setupSockets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createClient, RedisClient } from 'redis';
import cookie from 'cookie';
import * as cookie from 'cookie';
import { Server } from 'http';
import { Server as SocketIoServer } from 'socket.io';
import { Application, Request, Response, NextFunction } from 'express';
Expand Down Expand Up @@ -46,9 +46,10 @@ const setupApiSockets = (server: Server, app: Application) => {
//eslint-disable-next-line @typescript-eslint/no-floating-promises
socket.join(socket.request.headers.tenant || config.defaultTenant.name);
const socketCookie = cookie.parse(socket.request.headers.cookie || '');

if (socketCookie) {
//eslint-disable-next-line @typescript-eslint/no-floating-promises
socket.join(socketCookie['connect.sid']);
socket.join(socketCookie['connect.sid'] || 'default-session-id');
}
});

Expand Down

0 comments on commit 850aa9a

Please sign in to comment.