Skip to main content

Server-Sent Events

SSE is the simplest way to push real-time updates from server to browser. Unlike WebSocket (bidirectional), SSE is one-way: the server pushes, the client listens. It works over plain HTTP, reconnects automatically, and is supported by all modern browsers. When to use SSE over WebSocket:
  • Live dashboards and feeds
  • Notification streams
  • Progress updates
  • Any scenario where the client only needs to receive data

Events

Creating Events
Events serialize to the SSE wire format:

Connection Manager

PrismSSEManager tracks connected clients and handles broadcasting:
SSE Manager

Middleware Endpoint

The simplest way to expose an SSE endpoint:
SSE Middleware
Clients connect with GET /events and receive a text/event-stream response.

Live Dashboard Example

Stock Price Dashboard
Browser Client
The browser’s EventSource API automatically reconnects when the connection drops. Use the retry field in your events to control how quickly clients reconnect.

Notification Feed

User Notifications via SSE

SSE vs WebSocket