This question evaluates a candidate's skill in asynchronous network programming and concurrent connection handling, including protocol parsing, room management, message broadcasting, and graceful resource cleanup using Python's asyncio.
asyncio)Implement a TCP chat server using Python asyncio.
Your server listens on a given port and supports multiple concurrent clients.
Protocol (line-based text):
<username>: <message>
Behavior requirements:
Extend the protocol to support:
/join <room>
: join (and create if needed) a named room.
/who
: return the list of usernames currently in the user’s room.
/quit
: disconnect.
Constraints / assumptions:
asyncio
/
socket
/ etc.).