(user: User)
| 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 | |
| 81 | export const socketManager = SocketManager.getInstance() |
nothing calls this directly
no outgoing calls
no test coverage detected