From 49dd3609789ce05c085754d9f95cc7cf2deffb88 Mon Sep 17 00:00:00 2001 From: senntou Date: Sun, 27 Oct 2024 10:52:04 +0900 Subject: [PATCH] =?UTF-8?q?update=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92=E5=85=A8=E5=93=A1=E3=81=AB=E9=80=81=E3=82=89?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/websocket/events.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/src/websocket/events.ts b/backend/src/websocket/events.ts index 757a8e5..11b9799 100644 --- a/backend/src/websocket/events.ts +++ b/backend/src/websocket/events.ts @@ -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) => {