SSEasy
SSE middleware for Connect & Express.
All messages in a single connection are sent with incrementing IDs. If the client passes an ID in a last-event-id
header, the middleware ignores messages until that ID is reached.
Use
On the server as a writeable stream:
var sse = ;var fs = ; app;
On the server with manual events:
var sse = ; app;
On the client (initial connection):
var source = '/stream';source; // id: 0// message: a message // id: 1// message: a second message
On the client (reconnect sending last-event-id: 0
header ):
var source = '/stream';source; // (message 0 was skipped)// id: 1// message: a second message