Browse files


  • Loading branch information...
1 parent 5a1ac23 commit 79178cba672738911864de3a2e6e66e2993cfd5e @banksean committed Feb 26, 2010
Showing with 43 additions and 13 deletions.
  1. +43 −13
@@ -1,26 +1,56 @@
-# node PUbSubHubub
+# node-PubSubHubub
-An [PubSubHubub]() client for [node](
+A [PubSubHubub]( client for [node](
+This is currently just the Subscriber client, no publishing interface yet. It takes care of starting up an http listener for hub callbacks to handle subscription confirmation and update delivery. It also parses the atom feed of the topic URI to automatically discover the hub for you.
+You just give it a topic URI and some callbacks for events that you care about on that feed and it handles the rest.
## Usage
+ var callbackPort = 4443;
+ var subscriber = new pshb.Subscriber(callbackPort);
+ subscriber.startCallbackServer(); // Start listening for subscription confirmation callbacks.
+ var topicUri = url.parse("http://localhost/foo");
+ var feedEvents = subscriber.listen(topicUri);
- var wf = new webfinger.WebFingerClient();
- var userUri = "";
- var fingerPromise = wf.finger(userUri);
- fingerPromise.addCallback(function(xrdObj) {
- // Do something with the user's xrd object
- }
+ feedEvents.addListener('subscribed',
+ function(feed) {
+ sys.puts('subscribed: ' + feed);
+ });
+ feedEvents.addListener('error',
+ function(error) {
+ sys.puts('ERROR: ' + error);
+ });
+ feedEvents.addListener('update',
+ function(atomFeed) {
+ sys.puts('got a PubSubHubub update: ' +;
+ }
+ );
## Example app
-From the top level directory of this project, run
+First you'll need to run a local PubSubHubbub hub. I recommend getting the one from []( and running it with AppEngine Launcher.
+Start it up on port 8086 (or change the demo feed in test.js to point to another port for the feed's hub).
- $ node webfinger-buzz.js <username>
+Then from the top level directory of this project, run
-and the application will output the latest google public Buzz entry from that user.
+ $ node test.js
+This starts up the hub callback listener, starts a demo feed on port 80 and requests a subscription to that feed via the hub you started in the previous step.
+Next you have to tell the hub that the feed has updated. Normally this would be taken care of by your blogging software and wouldn't require a manual step. Go to http://localhost:8086/publish and publish http://localhost/foo. You might have to go through http://localhost:8086/_ah/admin/queues and clear out feed-pulls and event-delivery queues. Then the demo app should have output the line "got a PubSubHubub update: http://localhost/foo" to stdout.
-Fix up the XRD and Atom parsers. Currently doesn't work on Yahoo's XRD, for example.
-Error handling.
+Async subscription confirmations
+Multiple listeners per topic URI
+Persist records of subscriptions instead of re-requesting them every time on startup
+Make a demo publisher app so you don't have to go through the AppEngine dev console to update the feed

0 comments on commit 79178cb

Please sign in to comment.