Thursday, 27 March 2014

Let People Know "In Real-Time" When Your blog is Updated with PubSubHubbub

As a blogger (Publisher) you want to notify the cyberspace about your new blog post, first to get it crawled faster, and second to avoid your article being stolen by another Blog and it gets crawled and ranked before you do.

That is when PubSubHubHub comes in handy as it sends realtime notifications to blogfeed hubs when you update your blog.

A simple, open, server-to-server webhook-based pubsub (publish/subscribe) protocol for any web accessible resources.

Pubsubhubbub is used for content publishing by many websites, including all blogs served by blogger.com and WordPress.com, news sites including CNN and Fox news, and social networks like diaspora

Parties (servers) speaking the PubSubHubbub protocol can get near-instant notifications (via webhook callbacks) when a topic (resource URL) they're interested in is updated.

The protocol in a nutshell is as follows:
  • An resource URL (a "topic") declares its Hub server(s) in its HTTP Headers, via Link: <hub url>; rel=”hub” . The hub(s) can be run by the publisher of the resource, or can be acommunity hub that anybody can use: Google's, or Superfeedr.
  • A subscriber (a server that's interested in a topic), initially fetches the resource URL as normal. If the response declares its hubs, the subscriber can then avoid lame, repeated polling of the URL and can instead register with the designated hub(s) and subscribe to updates.
  • The subscriber subscribes to the Topic URL from the Topic URL's declared Hub(s).
  • When the Publisher next updates the Topic URL, the publisher software pings the Hub(s) saying that there's an update.
The protocol is decentralized and free. No company is at the center of this controlling it. Anybody can run a hub, or anybody can ping (publish) or subscribe using open hubs.
Google and Superfeedr offer a public and scalable open hub for anybody to use.




How to Use PubSubhubhub with your feeds?

  • Add an //atom:link tag under //atom:entry for Atom feeds or under //rss:rss/channel for RSS feeds. The //atom:link tag should haverel attribute set to hub and href attribute set to https://pubsubhubbub.appspot.com/
  • Alternatively, your feed can be served with two Link headers:
    • one with rel attribute set to hub and href attribute set to https://pubsubhubbub.appspot.com/
    • one with rel attribute set to self and href attribute set to the feed URL of the feed
  • The above is covered in more detail in the PubsubHubbub 0.4 specification.
  • Whenever new content is added to a feed, notify the hub. This is accomplished by sending a POST request tohttps://pubsubhubbub.appspot.com/ with Content-Type: application/x-www-form-urlencoded and two parameters encoded in the body:
    • hub.mode equal to publish
    • hub.url equal to the feed URL of the feed that has been updated. This field may be repeated to indicate multiple feeds that have been updated

Hub debug

From here you can,
  • Subscribe to a feed or debug your subscriber
  • Publish a feed or debug your published feeds

If you are a WordPress Blogger and wants to Ping the hub easily, there is a Plugin for that.
https://wordpress.org/plugins/pubsubhubbub/

The Plugin does the following:

Sends realtime notifications when you update your blog
Supports multi-user installations (WordPress MU)
Supports multiple hubs
Supports all of the feed formats used by WordPress, not just ATOM and RSS2
Supports latest spec (Version 0.4)
Announces which hubs you are using by adding <link rel="hub" ...> declarations to your template header and ATOM feed
Adds <atom:link rel="hub" ...> to your RSS feeds along with the necessary XMLNS declaration for RSS 0.92/1.0
Post a Comment