This commit is contained in:
2024-09-26 18:31:23 +05:00
parent 726d42f6b4
commit be08f17387
+7
View File
@@ -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();