MCPcopy Create free account
hub / github.com/code100x/chess / removeUser

Method removeUser

apps/ws/src/SocketManager.ts:60–78  ·  view source on GitHub ↗
(user: User)

Source from the content-addressed store, hash-verified

58 }
59
60 removeUser(user: User) {
61 const roomId = this.userRoomMappping.get(user.userId);
62 if (!roomId) {
63 console.error('User was not interested in any room?');
64 return;
65 }
66 const room = this.interestedSockets.get(roomId) || []
67 const remainingUsers = room.filter(u =>
68 u.userId !== user.userId
69 )
70 this.interestedSockets.set(
71 roomId,
72 remainingUsers
73 );
74 if (this.interestedSockets.get(roomId)?.length === 0) {
75 this.interestedSockets.delete(roomId);
76 }
77 this.userRoomMappping.delete(user.userId);
78 }
79}
80
81export const socketManager = SocketManager.getInstance()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected