WebSocket is just a communication protocol. it gives you a bi-directional connection, nothing more. It's very low-level and doesn't define app-specific logic like "rooms", "users", or "events".
How to Implement Rooms in WebSocket (Node.js)
Here’s the conceptual workaround:
Maintain a rooms object on the server.
When a client wants to join a room, you add their socket to that room array.
When sending a message to a room, iterate over the clients in that room and send the message manually.