Need private packages and team management tools?Check out npm Teams »

pamplemousse

2.0.0 • Public • Published

Pamplemousse JS

Delicious SSE for the browser and Express 4

Features include:

  • Multiple channels!
  • Browserify code for the browser (pamplemousse-browser) and for ExpressJS (pamplemousse)
  • Takes care of keepalives!

On the server

var pamplemouse = require('pamplemousse')()

In your routes:

router.get('/orders/:orderID/status', function(req, res) {
	var orderID = req.params.orderID
	pamplemouse.subscribeToChannel(orderID, res)
});

When you'd like to send an update to connected clients, run sendToActiveChannels:

sendToActiveChannels(function(activeChannel){
	pamplemousse.sendUpdate(activeChannel, 'you are subscribed to '+activeChannel)
})

Install

npm i pamplemousse

DownloadsWeekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

6.79 kB

Total Files

7

Last publish

Collaborators

  • avatar