fixed bug

This commit is contained in:
AmirHossein Mahmoodi
2025-05-04 16:54:09 +03:30
parent 0760db111c
commit 851758be6b

View File

@@ -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);
}