Comparison with other tools
This section compares Better SSE with other server-sent events libraries for Node.
Better SSE was designed to be the easiest and most powerful library for using server-sent events, better than all other existing solutions.
Features
Feature | better-sse | sse-channel | sse | express-sse | sse-stream | sse-pubsub | nestjs @Sse | hono/streaming |
---|---|---|---|---|---|---|---|---|
Send events to individual clients | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Send events to multiple clients at once | ✔ | ✔ | ❌ | ❌ | ❌ | ✔ | ❌ | ❌ |
Send/Modify individual fields | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Framework independent | ✔ | ✔ | ✔ | ❌ | ❌ | ✔ | ❌ | ❌ |
TypeScript types | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ✔ |
EventSource polyfill support | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Automatic connection keep-alive | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ❌ |
Serialize data as JSON | ✔ | ✔ | ❌ | ✔ | ❌ | ✔ | ✔ | ❌ |
Sanitize newlines from data | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ |
Ignore client-given last event ID | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
Event history maintenance | ❌ | ✔ | ❌ | ❌ | ❌ | ✔ | ❌ | ❌ |
Modify response headers | ✔ | ❌ | ❌ | ✔ | ❌ | ❌ | ✔ | ✔ |
Modify response status code | ✔ | ❌ | ❌ | ✔ | ❌ | ❌ | ❌ | ❌ |
* Except event history maintenance… Coming soon!
Performance
You can run benchmarks yourself that compare Better SSE with other libraries in the benchmarks
project in the examples
directory.