Skip to content

Commit 992ab6b

Browse files
committed
Update roomManger.js
Remove commented out code
1 parent 97ba790 commit 992ab6b

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

Backend/CollabService/utils/roomManager.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@ function manageRoom(ws, roomId, userId, type) {
5454
break;
5555

5656
case "leave":
57-
// remove from room
58-
59-
/*
60-
rooms[roomId].sockets = rooms[roomId].sockets.filter(socket => socket !== ws);
61-
rooms[roomId].userIds = rooms[roomId].userIds.filter(user => user !== userId);
62-
63-
console.log(`User ${userId} left the room ${roomId}`);
64-
65-
// if no one in room delete room
66-
if (rooms[roomId].sockets.length === 0) {
67-
delete rooms[roomId];
68-
console.log(`Room ${roomId} is empty and deleted`);
69-
} else {
70-
broadcastUserListUpdate(roomId);
71-
}
72-
*/
7357
handleUserLeave(ws, roomId, userId);
7458
break;
7559
default:
@@ -79,26 +63,6 @@ function manageRoom(ws, roomId, userId, type) {
7963

8064
// Remove user when they disconnect
8165
ws.on('close', () => {
82-
83-
/*
84-
if (rooms[roomId]) {
85-
rooms[roomId].sockets = rooms[roomId].sockets.filter(client => client !== ws);
86-
rooms[roomId].userIds = rooms[roomId].userIds.filter(user => user != userId);
87-
88-
console.log(`User ${userId} left room ${roomId}`);
89-
90-
if (rooms[roomId].sockets.length === 0) {
91-
delete rooms[roomId];
92-
console.log(`Room ${roomId} is empty and deleted`);
93-
} else {
94-
// notify users of roomId of updated user list to display in frontend
95-
broadcastUserListUpdate(roomId);
96-
// notify users of user leaving the room
97-
broadcastUserLeaveFromSocketClose(roomId, userId);
98-
}
99-
100-
}
101-
*/
10266
handleUserLeave(ws, roomId, userId)
10367

10468
});

0 commit comments

Comments
 (0)