diff --git a/README.md b/README.md index 16813cb..3f78be3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@

## ๐Ÿ‘ฅ ์ฐธ๊ฐ€ํ•œ ์‚ฌ๋žŒ๋“ค + +![Project Logo](images/catheeyong.jpg) + diff --git a/src/chats/chats.gateway.ts b/src/chats/chats.gateway.ts index 7dc49e2..20c3b3f 100644 --- a/src/chats/chats.gateway.ts +++ b/src/chats/chats.gateway.ts @@ -107,13 +107,15 @@ export class ChatsGateway ); // MongoDB์˜ socketModel์— ์‚ฌ์šฉ์ž ์ •๋ณด ์ €์žฅ - await this.socketModel.create({ + const userInfo = await this.socketModel.create({ socketId: socket.id, nickname: payload.nickname, roomId: payload.roomId, profileImg: payload.profileImg, userId: payload.userId, }); + // sockets db์— ์ €์žฅ๋œ ์œ ์ €์ •๋ณด๋ฅผ userList๋ฐฐ์—ด์— ์ถ”๊ฐ€ + this.userList.push(userInfo); // ์ด์ „ ์ฑ„ํŒ… ๋‚ด์šฉ์„ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค. const chatHistory = await this.getChatHistory(payload.roomId); @@ -127,6 +129,7 @@ export class ChatsGateway // ์ด์ „ ์ฑ„ํŒ… ๋‚ด์šฉ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. socket.emit('chat_history', chatHistory); + // this.server.to(String(payload.roomId)).emit('chat_history', chatHistory); // ๋ฐฉ์— ์žˆ๋Š” ๋ชจ๋“  ์‚ฌ์šฉ์ž์—๊ฒŒ userList ์ „์†ก this.server.to(String(payload.roomId)).emit('user_connected', payload); // console.log('์œ ์ €๋ฆฌ์ŠคํŠธ ์ฝ˜์†”', this.userList); @@ -174,7 +177,6 @@ export class ChatsGateway nickname: messageData.nickname, profileImg: messageData.profileImg, roomId: messageData.roomId, - time: messageData.time, chat: messageData.message, // ์ˆ˜์ •: messageData.message๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ฑ„ํŒ… ์ €์žฅ });
์ด๋ฆ„