Skip to content

Commit

Permalink
Merge pull request #24 from DevKor-github/hotfix
Browse files Browse the repository at this point in the history
Fix(chat): InOutRoom socket error
  • Loading branch information
kyeahxx19 authored Nov 19, 2023
2 parents 88627f6 + eab92a2 commit 91b0560
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/chat/chat.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ export class ChatGateway
}

@SubscribeMessage('in_room')
handleInOutChat(
async handleInOutChat(
@ConnectedSocket() client: Socket,
@MessageBody() inRoomDto: InRoomDto,
) {
const adapter = this.server.adapter as any;
if (!inRoomDto.inRoom && adapter.rooms.get(inRoomDto.roomId).size == 2) {
this.chatService.updateAllReadTime(inRoomDto.roomId);
if (!inRoomDto.inRoom) {
if ((await adapter.rooms.get(inRoomDto.roomId).size) == 2) {
this.chatService.updateAllReadTime(inRoomDto.roomId);
}
} else {
this.chatService.updateReadTime(inRoomDto.roomId, client.data.userId);
}
Expand Down

0 comments on commit 91b0560

Please sign in to comment.