PubSubHubbub is a callback-based web protocol.
I put them together and the result is a PubSubHubbub client for NodeJS:
node-pshb on github
This project only includes a PubSubHubbub client interface, but to me that's the interesting part. You can specify an atom feed url, and functions to call when events happen on that feed due to PubSubHubbub.
The client library takes care of identifying the hub for that feed, requesting a subscription, and listening for subscription confirmation requests and feed updates from the hub.
It provides callback hooks for "subscribed", "update" and "error" events.
A simple client app looks like this:
var callbackPort = 4443; var subscriber = new pshb.Subscriber(callbackPort); // Start listening for subscription confirmation callbacks. subscriber.startCallbackServer(); var topicUri = url.parse("http://localhost/foo"); // Dummy feed, always has updates var feedEvents = subscriber.listen(topicUri); feedEvents.addListener('subscribed', function(atomFeed) { sys.puts('subscribed: ' + atomFeed.id); }); feedEvents.addListener('error', function(error) { sys.puts('ERROR: ' + error); }); feedEvents.addListener('update', function(atomFeed) { sys.puts('got a PubSubHubub update: ' + atomFeed.id); });
I tested this out with the Demo Hub running on a local AppEngine launcher.
The demo app creates a a second server to host a dummy feed on port 80, so http://localhost/foo always returns a feed with the current time as it's "last updated." This is so the test hub always thinks there's an update ready for you.
So start the appengine with the hub running locally (in this demo it's assumed to be on port 8086), then run the test.js app, then go to your hub with your browser and manually update http://localhost/foo.
I noticed that I had to manually run some tasks in the hub's work queue so if you don't see any updates try checking the Task Queues in the app console for the hub. Run any pending "feed-pulls" and "event-delivery" tasks. I imagine there's a way to make them do that automatically but I haven't dug around enough in there to find it.
So there you go, NodeJS and PubSubHubbub: it's callbacks all the way down.
I know about NodeJS and it's amazing evented IO, but I know nothing about PSHB. It might be nice to be explicit about the benefits of what you've done here. I do the same thing with my code, feeling that the benefit is astoundingly obvious, but most people don't even know what I've shown them. This is especially the case when your project depends on two very niche technologies: the people that know one library is small; the people who know them both are vanishingly small.
ReplyDeleteGood point, Josh- I guess after I write a bunch of code to do something I think is neat, I'm often too exhausted to write very much about why I think it's neat :)
ReplyDeleteI'll write a proper post on this later, but I see NodeJS and PSHB as sort of parallel developments. They're both built on asynchronous callback notifications as a way to use resources more efficiently.
Node is fast because it's non-blocking and evented. Everything is a callback. You register interest in specific events from sockets or other IO objects, and Node calls your callback whenever there's new data.
NodeJS uses threads more efficiently than the standard blocking model.
PSHB is a way to do callbacks between web applications, so you can register interest in some URL with a hub, and a hub calls your web application whenever that URL has updates. So you don't have to poll over and over, checking to see if anything has changed.
PSHB uses network resources more efficiently than the standard polling model.
I have a larger application in mind to demonstrate how this stuff can be used together but it's not ready yet. I figure I'll post some notes here as I make progress, even if it isn't immediately useful to anyone.
This site is called --verbose for a reason ;)
This is awesome! I'm going to add a link to this to the PubSubHubbub wiki if you don't mind.
ReplyDeleteAngularJS Training in Chennai AngularJS Training in Chennai Node.js Training in CHennai Angular 2 Training in Chennai Angular 2 Training in Chennai Node.js Training in CHennai Node.js Training in chennai MEAN Developer Training in Chennai
DeleteBackBoneJS Training in Chennai BackBoneJS Training in Chennai EmberJS Training in Chennai EmberJS Training in Chennai
A IEEE project is an interrelated arrangement of exercises, having a positive beginning and end point and bringing about an interesting result in Engineering Colleges for a particular asset assignment working under a triple limitation - time, cost and execution. Final Year Project Domains for CSE In Engineering Colleges, final year IEEE Project Management requires the utilization of abilities and information to arrange, plan, plan, direct, control, screen, and assess a final year project for cse. The utilization of Project Management to accomplish authoritative objectives has expanded quickly and many engineering colleges have reacted with final year IEEE projects Project Centers in Chennai for CSE to help students in learning these remarkable abilities.
DeleteSpring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai
@onebigfluke.com Not at all, please do! :)
ReplyDeleteHey. Are you part of the blogger team. Can you explain how I can get someone from blogger to address a complaint. I killed this blog addy, http://www.emptywoundhopefulheart.blogspot.com about three yrs ago. Some spammer reclaimed it, but they are using an unathorized pic of my small children who are minors. I'm pretty pissed off, especially since blogger seems to be ignoring the issue. Thanks.
ReplyDeletefitflop outlet
ReplyDeletemichael kors purses sale
mbt outlet
coach purse
abercrombie and fitch outlet
jordans for sale
fendi bags
fitflop shoes
ugg boots on sale 70% off
north face clearance
columbia outlet store
mont blanc
all jordan shoes
north face clearance
michael kors handbags
coach bags
puma shoes
coach outlet store online
cheap jordans
burberry scarf
gucci shoes
dior outlet
coach factory outlet
nike high heels online
jordan 11
juicy couture outlet
michael kors outlet store
nike factory outlet
new balance outlet store
michael kors outlet
hermes outlet
lebron james shoes
coach bags sale
cheap nfl
hollister outlet store
michael kors outlet
coach purse
20151102yxj-2
Interesting Article
ReplyDeleteJavascript Training in Chennai | HTML5 Online Training
JavaScript Training Courses | Javascript Online Training | Angular 2 Training in Chennai
discount oakley sunglasses
ReplyDeleteugg boots
moncler outlet online
pandora charms
longchamp sale
nike blazer low pas cher
michael kors outlet online
jimmy choo shoes
hejixia20161202
coach outlet store
ReplyDeletejimmy choo
adidas nmd runner
replica rolex
michael kors handbags outlet
rolex replica
yeezy boost 350 black
coach outlet online
cheap nfl jerseys wholesale
cheap oakley sunglasses
Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback. TutuHelper
ReplyDeleteMost of the time I don’t make comments on websites. but I'd like to say that this article really forced me to do so. Really nice post! TutuAPp Andorid
ReplyDeleteteen patti apk download
ReplyDeleteteen patti apk download
best hookup apps
best hookup sites
best text chat sites
omegle alternative text sites
download play store pro apk free
download play store pro free apk
download play store pro apk free
download free play store pro
Best Nursing Diagnosis
ReplyDeleteBest Nursing Diagnosis
Best Nursing Diagnosis
Best Nursing Diagnosis
Best Nursing Diagnosis
Best Nursing Diagnosis
Best Nursing Diagnosis
Best Nursing Diagnosis
Best Nursing Diagnosis
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
ReplyDeletehadoop training in chennai
angularjs training in chennai
Kanhasoft is the top-notch Node.js development company in India. We have 45+ experienced programmers to delivered successful NodeJS Application development globally. Visit our site to know more about us.
ReplyDeleteIf your looking for Online Illinois license plate sticker renewals then you have need to come to the right place.We offer the fastest Illinois license plate sticker renewals in the state. organic ghee
ReplyDeleteThanks for sharing your innovative blog, it's more interesting.
ReplyDeletesalesforce course
best interview tips
professional courses after bsc
list of data analysis software
oracle interview questions for freshers
interview questions on pega
gret post agen sbobet88 online
ReplyDeleteI love your blog! You always have such interesting and thought-provoking content. google suite business
ReplyDelete