From 32fde3aec1310667c00a8f6406afc2b3a57fdf9b Mon Sep 17 00:00:00 2001 From: dwelle <5153846+dwelle@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:09:47 +0100 Subject: [PATCH] feat: change follow room naming scheme --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 44b63e0..03bf0c0 100755 --- a/src/index.ts +++ b/src/index.ts @@ -88,7 +88,7 @@ try { ); socket.on("user-follow", async (payload: OnUserFollowedPayload) => { - const roomID = `follow_${payload.userToFollow.socketId}`; + const roomID = `follow@${payload.userToFollow.socketId}`; switch (payload.action) { case "FOLLOW": { @@ -127,7 +127,7 @@ try { (_socket) => _socket.id !== socket.id, ); - const isFollowRoom = roomID.startsWith("follow_"); + const isFollowRoom = roomID.startsWith("follow@"); if (!isFollowRoom && otherClients.length > 0) { socket.broadcast.to(roomID).emit( @@ -137,7 +137,7 @@ try { } if (isFollowRoom && otherClients.length === 0) { - const socketId = roomID.replace("follow_", ""); + const socketId = roomID.replace("follow@", ""); io.to(socketId).emit("broadcast-unfollow"); } }