Challenge 1: Implement getRoomMembers — Possible Solution ==================================================================== function getRoomMembers(roomName) { const members = rooms.get(roomName); if (!members) return []; const userIds = []; for (const socket of members) { if (socket.userId) { userIds.push(socket.userId); } } return userIds; } WHY THIS WORKS -------------- - rooms.get(roomName) returns the Set of sockets currently in that room — the exact same Set that sendToRoom() iterates over for broadcasting, reused here for a read-only purpose instead. - If the room doesn't exist at all (nobody has ever joined it, or everyone has left and it was never cleaned up), rooms.get() returns undefined — returning an empty array in that case avoids the caller needing to handle "undefined" as a special case for a room with zero members versus a room that's never existed. - "if (socket.userId)" filters out any socket that doesn't have a userId assigned — this matters because not every connected socket is necessarily guaranteed to have completed whatever identifies it (e.g. a connection mid-authentication), so a defensive check here avoids surfacing an undefined entry in the returned list. - Returning a plain array of userIds (rather than the Set of sockets themselves) is deliberate: the caller building a "who's here" UI list needs simple, serializable user identifiers, not live socket objects — exposing the raw sockets would leak internal connection state to wherever this function's result eventually gets used (e.g. sent to a client as JSON).