Conversation
duyanh14
commented
Jul 3, 2022
- Notice of connected players
- Clear the room when all players leave
| currentRoom.set(playerId,player); | ||
| currentRoom.set(playerId, player); | ||
|
|
||
| // |
There was a problem hiding this comment.
Remove uneccessary comment mark
| currentRoom.set(playerId, player); | ||
|
|
||
| // | ||
| currentRoom.forEach((rplayer) => { |
There was a problem hiding this comment.
Đang không hiểu đoạn forEach có chức năng gì 😵💫
Nếu được thì ông thêm explanation vào đây và thêm comments nhé
There was a problem hiding this comment.
forEach được chạy khi có player bất kì ngắt kết nối. Nhiệm vụ gửi thông báo cho các player còn lại trong room về việc người chơi này đã ngắt kết nối
There was a problem hiding this comment.
Hình như nhầm đoạn forEach rồi thì phải. Tôi thấy đoạn này gửi message type là SUBSCRIBE mà
Cái t không hiểu lắm là tại sao tại phải có message type là SUBSCRIBE
There was a problem hiding this comment.
backstage/src/routers/ws/playRoutes.ts
Line 61 in 36abb68
|
Về phần message, có thể mình sẽ tạo ra một function riêng để tạo message và format. e.g. Trong đó thì mình sẽ map từ |
