express-sse
An Express middleware for quick'n'easy server-sent events.
About
express-sse
is meant to keep things simple. You need to send server-sent events without too many complications and fallbacks? This is the library to do so.
Installation:
npm install --save express-sse
or
yarn add express-sse
Usage example:
Options:
You can pass an optional options object to the constructor. Currently it only supports changing the way initial data is treated. If you set isSerialized
to false
, the initial data is sent as a single event. The default value is true
.
var sse = "array" "containing" "initial" "content" "(optional)" isSerialized: false initialEvent: 'optional initial event name' ;
Server:
var SSE = ;var sse = "array" "containing" "initial" "content" "(optional)"; ... app; ... sse;sse;sse;sse;sse;
Client:
var es = '/stream'; es { ...}; es;