diff --git a/src/room/room.gateway.ts b/src/room/room.gateway.ts index f79b416..30df8a4 100644 --- a/src/room/room.gateway.ts +++ b/src/room/room.gateway.ts @@ -22,9 +22,6 @@ export class RoomGateway extends CommonGateway implements OnGatewayDisconnect, OnGatewayInit, OnGatewayConnection { - @WebSocketServer() - public io; - constructor(protected jwtService: CustomJwtService) { super(jwtService); } diff --git a/src/room/room.service.ts b/src/room/room.service.ts index 65466f8..a219a72 100644 --- a/src/room/room.service.ts +++ b/src/room/room.service.ts @@ -75,7 +75,8 @@ export class RoomService { ); const participantIds = this.getParticipantIds(meeting); await this.userService.addRoom(chatRoom, participantIds); - this.roomGateway.io + this.roomGateway.io.server + .of('/chat-rooms') .in(participantIds) .emit('room-append', { ...chatRoom, id: chatRoom._id, meeting }); } @@ -117,9 +118,11 @@ export class RoomService { console.log(createdChat); console.log(chat.roomId); this.detailGateway.io.server + .of(`/chat-rooms/${chat.roomId}`) .to(chat.roomId) .emit('chat-append', createdChat); const sockets = await this.detailGateway.io.server + .of(`/chat-rooms/${chat.roomId}`) .in(chat.roomId) .fetchSockets(); const alreadyIn = sockets.map((socket) => socket.handshake.auth.userId); @@ -127,7 +130,8 @@ export class RoomService { .filter((user) => !alreadyIn.includes(user.id)) .map((user) => user.id); await this.userService.unreadItemPlus(notIn, room._id); - this.roomGateway.io + this.roomGateway.io.server + .of('/chat-rooms') .to(users.map((user) => user.id)) .emit('last-chat-append', createdChat); return createdChat;