Design: Real-time Notification System using Long Polling and Server-Sent Events
Design covers server architecture, client-server communication using Long Polling and Server-Sent Events, connection management, and fallback mechanisms. Out of scope are message content design and authentication mechanisms.
Functional Requirements
FR1: Deliver real-time notifications from server to clients
FR2: Support up to 10,000 concurrent clients
FR3: Ensure notifications are delivered with latency under 1 second
FR4: Allow clients to receive updates without frequent polling
FR5: Support fallback from Server-Sent Events to Long Polling if SSE is not supported
FR6: Handle client reconnections gracefully without losing messages
Non-Functional Requirements
NFR1: System must maintain 99.9% uptime (about 8.77 hours downtime per year)
NFR2: API response latency p99 under 500ms for connection establishment
NFR3: Support clients on modern browsers and some legacy browsers
NFR4: Minimize server resource usage for idle connections