fixed bug
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user