Skip to content

mikemaccana/pamplemousse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
})

About

Simple SSE for the browser and node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published