PuSHPress: A PubSubHubbub Plugin For WordPress

PubSubHubbub, or PuSH, is now supported on all WordPress.com blogs. For those running sites using the WordPress.org software the PuSHPress plugin is available to do the same thing. The big difference in this plugin compared to the other PuSH WordPress plugins is that it includes a PuSH hub built in.

A little bit of PubSubHubbub background

Like rssCloud, PuSH adds a line to your feed to let clients know where they can send PuSH subscription requests. In the RSS2 feed this looks like:

<atom:link rel="hub" href="http://josephscott.org/?pushpress=hub">

and in Atom looks like:

<link rel="hub" href="http://josephscott.org/?pushpress=hub">

The href attribute contains the URL that subscribers can send requests to. Details on what that request looks like are in the PubSubHubbub Spec. The short version, it’s a simple HTTP POST call with some specific field names.

Here’s an example PHP subscription request asking that updates to http://example.com/feed/ be sent to http://example.com/push/ via the hub at http://example.com/?pushpress=hub

$curl = curl_init( );

curl_setopt( $curl, CURLOPT_URL, 'http://example.com/?pushpress=hub' );
curl_setopt( $curl, CURLOPT_POSTFIELDS, 'hub.callback=http://example.com/push/&hub.mode=subscribe&hub.secret=not-telling-you&hub.verify=sync&hub.topic=http://example.com/feed/&hub.verify_token=133t-$7r1n9' );
curl_setopt( $curl, CURLOPT_VERBOSE, 1 );
curl_setopt( $curl, CURLOPT_POST, 1 );

curl_exec( $curl );
print_r( curl_getinfo( $curl ) );
curl_close( $curl );

The hub at example.com will then send new content (in feed format) right after it’s published to URL provided in hub.callback.

Why the PuSHPress plugin?

I love that there are large, open PuSH hubs available for anyone to use. There’s a list at http://code.google.com/p/pubsubhubbub/wiki/Hubs. In PuSH since most of the hard work (figuring out what’s new in a feed and sending that out to subscribers) is done via the hub this is very handy and really great for testing.

I also think there’s a role for a readily available simple hub that anyone can put up and use, in this case built on top of WordPress. And by leveraging WordPress the hub part can be greatly simplified. The real bonus for users is choice, they can relay the updates through 3rd party hubs, or use the built in hub in PuSHPress.

It’s worth noting that PuSHPress has a WordPress filter on the array of hubs; pushpress_hubs. This allows other plugins to easily add to or replace the hubs mentioned in the feeds by PuSHPress.

To help keep things simple and limit potential abuse the PuSHPress plugin will only allow subscriptions for the RSS2 and Atom feeds of the WordPress blog that it is installed on.

My thanks to Brett Slatkin for helping test PuSHPress. His tests revealed a few bugs that were quickly addressed.

How fast?

When talking about these realtime-ish update features this question often comes up. Fair enough, I’d want to know too :-)

The PuSHPress plugin schedules pings to go out right away via the wp_schedule_single_event function in WordPress. I suspect for most people this will be quite fast. If your server is under tremendous load and really slow, then this will be really slow too, just like the rest of the server ;-)

On WordPress.com the details are a bit different. Instead of scheduling pings to be sent out with wp_schedule_single_event it adds them to our asynchronous jobs system ( more info available at http://code.trac.wordpress.org/ ). The jobs system is setup to do exactly these kinds of tasks really, really fast. Don’t be surprised if the ping shows up before you get a chance to finish the first Mississippi.

The future

So where is all this going? Who knows, but it is fun to watch! :-)

Further reading

If you have an interest in this area there are plenty of resources:

The spec is a quick read and to the point, worth reading.

And there you have it, a little more in-depth discussion of PuSHPress.

No related posts.

This entry was posted in Posts and tagged , , , . Bookmark the permalink.

52 Responses to PuSHPress: A PubSubHubbub Plugin For WordPress

  1. Julien says:

    Well done Joseph, this is a very exciting news!

  2. Matt Terenzio says:

    Looks great. The wheels keep turning.

  3. mark k. says:

    Is anyone working on making the rss widget to be a client of rsscloud and PuSH whenever they are supported at the originating server of the rss feed?

    • Joseph Scott says:

      Excellent question. I haven’t heard anyone mention that, but would be neat to see. Really any plugin that consumes RSS/Atom feeds could potentially benefit from having rssCloud and PuSH support.

  4. Ipstenu says:

    Interesting… how will this work with FeedBurner feeds? The rssCloud plugin manages to plugin into those. Will this too?

  5. Pingback: WordPress.com Pushes PuSH PubSubHubbub | WordCast - BBlogging news, Blogging podcasts, WordPress podcasts, WordPress plugins, WordPress themes, WordPress news

  6. Pingback: PubSubHubbub is now enabled on all Wordp… « Paul M. Watson

  7. Moja Izba says:

    Great news, I am trying this PubSubHubbub plugin too.

    • Joseph Scott says:

      I mentioned in a few different places that what makes PuSHPress different from the other PuSH plugins available is that it has a built in hub. The plugin you linked to uses a 3rd party hub to relay updates out to subscribers. Either one will enable PuSH for your WordPress site, how exactly do that is the difference.

  8. Tschai says:

    Works fan-tas-tic, even with feedburner: http://feeds.feedburner.com/fan-tas-tic

    The feeds is published (almost) real-time!

    Thanks a lot!

  9. I’m curious: does this negate the need for the Update Services in WordPress (http://codex.wordpress.org/Update_Services if others are curious)? If so, would you recommend that folks clear out that field and install this plugin instead? Can you give a quick comparison, maybe?

  10. I think I’m missing something.

    Please can someone help?

    I installed and activated the PuSH Press plugin. NOTHING has changed with my feeds. Even when I manually use:

    http://ubuntulinuxhelp.com/?pushpress=hub

    It returns an error that says:

    “hub.callback is empty”

    If I click the RSS icon in the address bar of the browser and select either RSS2 or Atom, it functions the way it’s always done. That is the RSS2 and Atom links do NOT look like the ones displayed in your “A little bit of PubSubHubbub background” section above.

    What, if anything, have I done wrong. The installation information for the PuSH Press plugin said there was nothing to configure, just install and go.

    Any help would be appreciated. Thanks!

    • Joseph Scott says:

      I tried to look at your feed by requesting http://ubuntulinuxhelp.com/feed/ but it returned a 403 Forbidden error.

    • PubCrawl says:

      When I post to pushpress (i.e. “ping” the hub, per section 7.1 of pubsubhubbub), I get a 400 Bad Request, with the body set to hub.callback is empty. The request and response are below. Any ideas?

      Thanks

      POST http://localhost/wordpress/?pushpress=hub HTTP/1.1
      Host: localhost
      User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      Accept-Language: en-us,en;q=0.5
      Accept-Encoding: gzip,deflate
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Keep-Alive: 115
      Connection: keep-alive
      Content-Type: application/x-www-form-urlencoded; charset=UTF-8
      Content-Length: 62
      Cookie: wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_bbfa5b726c6b7a9cf3cda9370be3ee91=admin_wp%7C1281542756%7Cf544f2e2c569e9e86c23015e92de1268; wp-settings-time-1=1281111646; wp-settings-1=editor%3Dhtml%26m0%3Do%26m1%3Do%26m2%3Dc%26m3%3Dc%26m6%3Do
      Pragma: no-cache
      Cache-Control: no-cache

      hub.mode=publish
      hub.url=http://localhost/wordpress/?feed=atom

      RESPONSE
      HTTP/1.0 400 Bad Request
      Date: Mon, 09 Aug 2010 16:52:42 GMT
      Server: Apache/2.2.14 (Win32) PHP/5.3.1
      X-Powered-By: PHP/5.3.1
      Content-Length: 21
      Connection: close
      Content-Type: text/plain; charset=utf-8

      hub.callback is empty

  11. Eric Williams says:

    It probably depends on if “PingShot” is enabled in FeedBurner, enabling it also enables FeedBurner’s built-in PubSubHubbub support. If you’re using FeedBurner’s features, you probably don’t want WordPress handling PubSubHubbub, it’ll prevent FeedBurner’s modifications (such as feedflairs) and tracking (subscriber count, clicks) from working properly. (WordPress will notify directly, FeedBurner won’t get a chance to process it)

  12. Pingback: WordPress Plugin Releases for 03/05 « Weblog Tools Collection

  13. Pingback: 7 WWMAG-Surftipps: Web-Debatte, Wordpress, Foto-Tipps, Feminismus und Herzblut

  14. radekg says:

    Great work! Thank you :)
    I write about this plugin on my blog: http://izbieractwo.pl/2010/03/09/wordpress-i-pubsubhubbub-push/ (in polish)

  15. windhamdavid says:

    very nicely done! thank u

  16. Pingback: Plugin Monday: Real-Time Syndication in WordPress with PuSHPress

  17. Tzafrir says:

    I tried to look through the code but could not find the answer – Does this function as a generic hub, or is it married to WordPress?

    What I’d like to do is to add the wordpress hub to the rss feeds on a phpbb forum, and have the hub ping the forums often to get feed updates. PuSH defines that the hub should ping the source every interval, so this isn’t against standard use, and will be much easier than hacking a pinging mechanism into phpbb.

    • Joseph Scott says:

      The PuSHPress plugin will only accept subscription requests for the WordPress RSS2 and Atom feeds.

    • Eric Williams says:

      If you define a hub in your feed, you should probably ping it, that’s kind-of the point. Without the pings it’s not live… the point of PuSH is to send messages via a push system, not a polling system. The polling you’re talking about is to make sure the feed still exists, and, in the case of some hubs, allow a PuSH-only subscriber to subscribe to non-PuSH feeds.

      In terms of which hub to use, you might consider just using an open hub, such as http://pubsubhubbub.appspot.com/, if you don’t want to implement/run your own.

  18. phrozen77 says:

    Hi Joseph,

    great plugin – thanks for that!

    I just wonder, will there be some way to see the subscriber count via PuSH sometime?

  19. Pingback: BuddyPress Social Networking | The WordPress Podcast

  20. Pingback: PuSHPress實現即時Google收錄 « Blog|WSQSITE

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>