diff --git a/src/socket/socket.gateway.ts b/src/socket/socket.gateway.ts index 3348783..32ea9e4 100644 --- a/src/socket/socket.gateway.ts +++ b/src/socket/socket.gateway.ts @@ -9,7 +9,6 @@ import { SendMessageDto } from './dto/sendMessage.dto'; import { SocketService } from './socket.service'; @WebSocketGateway({ - namespace: '/notification', cors: { origin: '*', }, @@ -57,10 +56,12 @@ export class SocketGateway implements OnGatewayConnection { } getConnectedClients(clientsId: string[]): Socket[] { - const connectedClients = this.server.sockets.sockets; + const socketsMap = this.server?.sockets?.sockets; + if (!socketsMap) return []; + const clients: Socket[] = []; - for (const client of connectedClients.values()) { + for (const client of socketsMap.values()) { if (clientsId.includes(client.handshake.auth.token)) { clients.push(client); }