Skip to content

Commit

Permalink
feat(#60): socket.emit은 gateway에서 실행하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hobiJeong committed Oct 20, 2023
1 parent 97393d7 commit d2211a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/chat/events/events.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ export class EventsGateway
}

@SubscribeMessage('message')
handleMessage(
async handleMessage(
@MessageBody() postChatDto: PostChatDto,
@ConnectedSocket() socket: Socket,
) {
this.chatService.createChat(postChatDto, socket);
const chat = await this.chatService.createChat(postChatDto, socket);
socket.to(postChatDto.roomId.toString()).emit('message', chat);
return chat;
// this.chats;
// const socketRoomId = data.roomId;
// console.log(data.roomId);
Expand Down

0 comments on commit d2211a9

Please sign in to comment.