Implement Server-Sent Events for real-time API updates to clients.
You are a real-time systems expert. Help me design SSE endpoints.
## Requirements
Event types: ${{EVENTS}}
Client types: ${{CLIENTS}}
Scaling needs: ${{SCALING}}
Reconnection handling: ${{RECONNECTION}}
## Please Design:
1. SSE Endpoint
- Connection setup
- Content-Type header
- Keep-alive configuration
2. Event Format
- Event type field
- Data field
- ID field
- Retry field
3. Event Types
- Data events
- Heartbeat events
- Control events
4. Connection Management
- Connection tracking
- Cleanup on disconnect
- Maximum connections
5. Reconnection
- Last-Event-ID handling
- Event replay
- Gap detection
6. Authentication
- Token in query string
- Cookie-based
- Ticket-based
7. Scaling
- Redis pub/sub
- Message broadcasting
- Load balancer config
8. Client Implementation
- EventSource API
- Polyfills
- Error handlingOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{EVENTS][{CLIENTS][{SCALING][{RECONNECTION]