
Server-Sent Events with Claude Code: Real-Time Push Without WebSocket Complexity
Notifications, progress bars, live feeds — these don't need WebSocket's bidirectional complexity. Server-Sent Events give you server-to-client streaming with automatic reconnection built in. Claude Code generates the full implementation. CLAUDE.md for SSE Standards ## Server-Sent Events (SSE) Rules ### When SSE is the right choice - Server → client one-way streaming - Notifications, progress updates, live feeds, dashboard updates - No client-to-server data needed ### Use WebSocket instead when - Bidirectional communication (chat, games, collaboration) - Binary data transfer ### Implementation rules - Headers: Content-Type: text/event-stream, Cache-Control: no-cache - X-Accel-Buffering: no (disable Nginx buffering) - Auth: query parameter token (EventSource can't set Authorization header) - Reconnection: use Last-Event-ID to resume from where client left off - Heartbeat: send comment every 30 seconds to keep connection alive - Max connections: 5 per user ### Security - SSE endpoints req
Continue reading on Dev.to Webdev
Opens in a new tab




