Skip to content

Commit

Permalink
updateメッセージを全員に送られるバグを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
senntou committed Oct 27, 2024
1 parent 885aae2 commit 49dd360
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions backend/src/websocket/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
} from "../utils/users.js";

const emitUpdate = (io: Server, groupId: number) => {
io.emit(
"update",
groups[groupId].map((socketId) => users[socketId].name)
);
groups[groupId].forEach((socketId: string) => {
io.to(socketId).emit(
"update",
groups[groupId].map((socketId) => users[socketId].name)
);
});
};

export const createInitEvent = (socket: Socket, io: Server) => {
Expand Down

0 comments on commit 49dd360

Please sign in to comment.