From be08f1738716325dea085104161111a9d775f38a Mon Sep 17 00:00:00 2001 From: inmake Date: Thu, 26 Sep 2024 18:31:23 +0500 Subject: [PATCH] upd --- src/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/index.ts b/src/index.ts index cfa0c27..92a0249 100644 --- a/src/index.ts +++ b/src/index.ts @@ -81,6 +81,13 @@ io.on("connection", async (socket) => { io.to(roomId).emit("update", updatedRoomUsers); }); + socket.on("message", (text) => { + io.to(roomId).emit("message", { + userId: socket.handshake.auth.user.id, + text, + }); + }); + socket.on("disconnect", async () => { const sockets = await io.in(roomId).fetchSockets();