pb

primus-broadcast

Adds socket.io style broadcast functionality to primus

Showing:

Popularity

Downloads/wk

1

GitHub Stars

2

Maintenance

Last Commit

8yrs ago

Contributors

0

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

primus-broadcast

npm install primus-broadcast

A plugin for primus that adds a broadcast function to the socket/spark that excludes the the instance you're broadcasting from, the same way it works in socket.io.

If you are using the primus-emitter plugin as well, this will favor the .send() function over the .write() function. (You will have to pass this plugin to primus after you pass the primus-emitter one.)

var primusBroadcast = require('primus-broadcast');

primus.use('broadcast', primusBroadcast);

spark.on('data', function message(data) {
  // equivalent to socket.broadcast.emit() or socket.broadcast.send() in socket.io
  spark.broadcast('Received some data');
});

The implementation is very simple (look for yourself) but nice to have as a module.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial