Write apps/backend/docs/concepts-gateway-architecture.md explaining the WebSocket gateway's structural pieces: services/roomManager.ts (conversation + user rooms), services/resumeStream.ts (Redis Streams-backed missed-event replay), services/rateLimit.ts (per-socket rate limiting/payload caps), services/backpressure.ts (slow-consumer handling), and the Redis pub/sub cross-node fan-out.
Acceptance criteria:
- Room types and their purpose are explained, including why membership is re-validated against Postgres rather than trusted from room state alone
- The resume/replay mechanism is explained with its bounding/TTL behavior
- Rate limiting, payload caps, and backpressure/shedding thresholds are documented with their current configurable values and env var names
Write
apps/backend/docs/concepts-gateway-architecture.mdexplaining the WebSocket gateway's structural pieces:services/roomManager.ts(conversation + user rooms),services/resumeStream.ts(Redis Streams-backed missed-event replay),services/rateLimit.ts(per-socket rate limiting/payload caps),services/backpressure.ts(slow-consumer handling), and the Redis pub/sub cross-node fan-out.Acceptance criteria: