Spec a chat server that survives real networks
Your task
Your team is adding live chat to a web app: rooms, a list of who is online, and message history. An agent will build the WebSocket server in TypeScript on Node with the ws library, plus the browser client. A laptop demo worked on the first try. Production runs 3 server instances behind a load balancer, and many users are on phones.
Write the build spec you would hand the agent, with the stages in order and the acceptance checks.
What you know:
- messages are stored in Postgres, and Redis is available
- users sign in with a session cookie on the same domain
- a room has at most 500 members
Then, in a few sentences: what breaks when the laptop demo meets production?