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.
TL/DR: Better SSE supports all* the features that other competing libraries do and much more. It is TypeScript-first (but obviously can be used with JavaScript), very well tested, easier to scale and much more flexible than others whilst still having a simpler programming interface for both simple and complex use cases.
Feature | better-sse |
sse-channel |
sse |
express-sse |
server-sent-events |
easy-server-sent-events |
sse-stream |
---|---|---|---|---|---|---|---|
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!
You can run benchmarks yourself that compare Better SSE with other libraries in the benchmarks
project in the examples
directory.