Redis adapter for sse-broadcast.
SSE is a long-polling solution, consequently if you want to broadcast events to every client subscribed to a given channel then you’ll need some way of passing messages between processes or computers. This package distributes events across nodes on top of Redis.
const os =cluster =if clusterisMasterfor var i = oslength; i--;clusterelseconst app =sse =sse host: 'localhost' port: 6379appappapp
Note: options are passed to redis directly.
const Adapter =
Package's main export is the adapter constructor. Its first argument is a required
second is an optional redis client or an options object for
redis.createClient(). See redis documentation regarding the available settings.
Circular reference to the adapter constructor for those who find
require('sse-broadcast-redis').Adapter more expressive.
The version string from package manifest.
const adapter = broadcaster
adapter.unref(), adapter.quit() and adapter.end([flush])
Call the corresponding methods of internally used redis clients.
error events of internal clients.
sse-broadcast-redis is compatible with Node.js
0.12 and above.
npm install sse-broadcast-redis