feat: websocket init

This commit is contained in:
2025-12-11 21:02:02 +00:00
parent a335e713ee
commit 69705ce61c
3 changed files with 63 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
const users = new Map();
export const addUser = (socket, user) => {
users.set(socket.id, user);
};
export const removeUser = (socketID) => {
const userToDelete = { ...users.get(socketID) };
users.delete(socketID);
return userToDelete;
};
export const getUser = (socketID) => {
return users.get(socketID);
};
export const getUserCount = () => {
return users.size;
};