Skip to content

A simple set of functions to handle PubSubHubbub handshakes & verification

License

Notifications You must be signed in to change notification settings

sujal/node-push-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node PuSH helper

A simple set of functions to handle PubSubHubbub handshakes & verification.

Details

Many services including RSS aggregators like Google Reader, social networks like Facebook, and photo services like Flickr & Instagram implement some variation of the PubSubHubbub protocol (PuSH).

There are two generic bits of functionality that are required when subscribing for PuSH updates from these services. First, we need to complete a handshake with the server when subscribing.

The second bit is verifying the notification when the server pushes an update. Both of these are standard, service independent bits of code, so it didn't make sense to use code that's in a particular library. This library does nothing but those two functions and exposes simple methods that can be used in an express.js app or anywhere else.

Examples

Here's my subscription code from my app.

// a GET request will be a challenge query
app.get('/instagram/realtime', function(req, res){
  PuSHHelper.handshake(req, res);
});

// this is where Instagram will send updates (using POST)
app.post('/instagram/realtime', PuSHHelper.verifier(config.instagram.client_secret), function(req, res){
  console.log("Received a notification");
  
  // process the notifications
  
});

You can see a working example in the Proxigram source code.

Credits

The library draws functionality from the instagram-node-lib NPM located at https://github.com/mckelvey/instagram-node-lib and the nubnub project located here: https://github.com/technoweenie/nubnub


License

See the LICENSE file for information

About

A simple set of functions to handle PubSubHubbub handshakes & verification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published