Use cases and boundaries
A host keeps its own HTTP router and passes an open response to SSEKify. The library groups connections by user or room and can queue writes for slow clients. Use the memory path for one process, or explicitly connect the optional Redis Pub/Sub adapter for fan-out across instances.
Getting started and compatibility
Install the released package
npm install ssekify@0.1.6
Node.js 16+ per package metadata. The example assumes an already authenticated request and must register before writing headers or body. sendToUser delivers locally on this instance. Event streaming is one-way; authentication, proxy timeouts and any durable offline delivery are application concerns.
import { SSEKify } from 'ssekify';
const events = new SSEKify({ keepAliveMs: 15_000 });
// In an authenticated GET handler, with its open Node response:
events.registerConnection(subjectId, response);
// From your application when there is a status update:
events.sendToUser(subjectId, { state: 'ready' }, { event: 'job-status' });