Skip to content

Better SSE

Dead simple real-time server-to-client communication without WebSockets.

Features

Easy real-time communication

Operates directly over HTTP.
No pinging, long-polling or WebSockets required.

Multi-client broadcasting

Send events to individual clients or to many at once using broadcast channels.

Highly configurable

Modify reconnection time, message serialization, data sanitization, response headers and more (with good defaults).

Event batching

Batch and send multiple events in a single transmission to improve performance and lower bandwidth usage.

First-class TypeScript

Fully written in TypeScript and ships with types directly.
Define types for state and event data.

Pipe streams and iterables

Automatically pipe stream and iterable data to the client as a series of events.

Set up in 10 lines of code

import { createSession } from "better-sse"
app.get("/sse", async (req, res) => {
const session = await createSession(req, res)
session.push("Hello world!")
})

Get started