Skip to content

PuSHPress: A PubSubHubbub Plugin For WordPress

03 Mar 2010

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.

Related posts:

  1. RSSCloud For WordPress
  2. mod_ping, Maybe I Should Have Called It PubSubHubbub
  3. rssCloud WordPress Plugin Update – 0.4.1
  4. WordPress Plugin Update: LibXML2 Fix
  5. WordPress & libxml2 Episode IV: A New Plugin

From → Posts

48 Comments
  1. Well done Joseph, this is a very exciting news!

  2. Matt Terenzio   3 Mar 2010

    Looks great. The wheels keep turning.

  3. 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?

    • 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. Interesting… how will this work with FeedBurner feeds? The rssCloud plugin manages to plugin into those. Will this too?

    • I haven’t tried it with FeedBurner. I’d be interested to hear what happens in the feed from people using FeedBurner.

      I suspect that they pass the hub element through untouched, though I haven’t confirmed that yet.

      • I’ll give her a whirl then :) On WP 3.0 multisite no less.

      • My feedburner entry returns
        this XML, just for reference.

      • Seems to be working for me, so yay :)

      • Big City Informer   4 Mar 2010

        After we enabled the plugin on our WPMU site (sitewide activated) it seems like the hub element is just passed through for all feeds as you expected. Check it out here if you like:

        http://feeds.feedburner.com/BigCityInformer

        Now we need to see how feed applications use it and if it really speeds things up as compared to the usual old ping – options :-)

        Thanks
        Big City News

        • Yep, I see the PuSHPress hub listed in your FeedBurner feed. Looks like FeedBurner is just passing it through, which is what I’d expected/hoped.

          • Big City Informer   5 Mar 2010

            Hey, it is lightning fast I would say. Feedburner used to take up to 30 minutes for a new item to be updated in the feeds properly. Now as soon as we press publish, it gets updated from the guys at Feedburner. So maximum 5 minutes and all other Feedburner – attached services are also updated.That’s so cool, thanks again for the plugin Joseph :-)
            Is there a good list available somewhere with all the services using PuSHPress for fetching?

            Can the same process be used for Google sitemaps somehow? Are they using PuSHPress in any way? That would be perfect, once published directly in the index :-)

          • I’m not aware of a list like that, though PuSHPress is just PubSubHubbub, so any service that supports that will work fine with PuSHPress.

            I don’t know exactly what Google’s plans are, you’ll have to ask them :-)

  5. Moja Izba   3 Mar 2010

    Great news, I am trying this PubSubHubbub plugin too.

    • 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.

  6. Tschai   4 Mar 2010

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

    The feeds is published (almost) real-time!

    Thanks a lot!

  7. 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?

  8. 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!

  9. Eric Williams   4 Mar 2010

    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)

    • Figuring out what feed proxies should when a feed already has a hub is something that is being talked about on the PuSH email list.

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

  11. very nicely done! thank u

  12. Tzafrir   16 Mar 2010

    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.

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

    • Eric Williams   17 Mar 2010

      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.

  13. Hi Joseph,

    great plugin – thanks for that!

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

    • That certainly something that could be added. I don’t have any immediate plans for adding them, but it’s something I’ll keep in mind.

Trackbacks & Pingbacks

  1. WordPress.com Pushes PuSH PubSubHubbub | WordCast - BBlogging news, Blogging podcasts, WordPress podcasts, WordPress plugins, WordPress themes, WordPress news
  2. PubSubHubbub is now enabled on all Wordp… « Paul M. Watson
  3. WordPress Plugin Releases for 03/05 « Weblog Tools Collection
  4. 7 WWMAG-Surftipps: Web-Debatte, Wordpress, Foto-Tipps, Feminismus und Herzblut
  5. Plugin Monday: Real-Time Syndication in WordPress with PuSHPress
  6. BuddyPress Social Networking | The WordPress Podcast
  7. PuSHPress實現即時Google收錄 « Blog|WSQSITE

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS