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.

53 Comments

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

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

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

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

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

  7. I’ll give her a whirl then ๐Ÿ™‚ On WP 3.0 multisite no less.

  8. Great news, I am trying this PubSubHubbub plugin too.

  9. I looked at http://feeds.feedburner.com/jleveron and the only hub it lists is http://pubsubhubbub.appspot.com/. Do you still have the PuSHPress plugin enabled on your site?

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

  11. Aye, Version 0.1.4 shows active. Perhaps there’s a config spot I missed ? Thanks for the plugin . . .

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

    The feeds is published (almost) real-time!

    Thanks a lot!

  13. Seems to be working for me, so yay ๐Ÿ™‚

  14. Big City Informer

    Thu 4 Mar 2010 at 7:18 am

    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

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

  16. I’ll need to look closer at what FeedBurner is actually doing then.

  17. Interesting, I do see the PuSHPress hub in your FeedBurner feed.

  18. I don’t see this as directly replacing the update services.

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

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

  21. I’m not sure why my feed isn’t passing through to feedburner then, gahhh ๐Ÿ™‚ Since it seems to be working for others.

    There were blog entries made after the plugin was added (plain WP 2.9.2, etc.)

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

  23. That’s strange! I just clicked the link you provided me and it redirected to here: http://feeds2.feedburner.com/ubuntulinuxhelp/ERrG

    Which link was giving you the 403 error?

    The browser address bar RSS or the left side bar RSS?

  24. Oops… that should have been “Right” side bar.

    The “Click to edit” here (Ajax editor), just opens as a blank white page, so could not edit it.

  25. 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)

  26. The ‘Post feed’ in your sidebar links to http://ubuntulinuxhelp.com/feed/ and the same for the feed URL in your HTML header. When I request URL it returns 403 Forbidden.

    Since you mentioned http://feeds2.feedburner.com/ubuntulinuxhelp/ERrG I looked at that feed and it does have the PuSHPress hub listed.

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

  28. Big City Informer

    Fri 5 Mar 2010 at 4:19 am

    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 ๐Ÿ™‚

  29. 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 ๐Ÿ™‚

  30. @Joseph Scott

    THANK YOU!

    I do have two questions (can you answer them?)

    1) Where do I see that PuSHPress hub is listed (I cannot see it so am obviously not looking where you are)?

    2) What application are you using to access the RSS feed, or how? (After your 403 error, I got worried and had several people test it; and they could all access it).

    Thanks muchly again.

  31. 1) In your feeds search for the line that contains pushpress=hub, that’s the element that describes where your hub is at.

    2) curl

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

  33. very nicely done! thank u

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

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

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

  37. Hi Joseph,

    great plugin – thanks for that!

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

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

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

  40. Yes, but… I’m not *subscribing*, I’m “ping”ing the hub to publish an update to my blog, per
    http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html#anchor9. The way I read the spec is that to avoid polling (polling sucks, eh?) you notify the hub of new content, which then is supposed to be queued for distribution?

  41. The PuSHPress plugin includes a hub, there is no need to manually ping a hub about updates. When you publish a new post in WordPress PuSHPress knows about it, so it can immediately turn around and send out the client pings.

    If you are using PuSHPress to add PuSH support to your WP install the only thing you need to do is activate the plugin, it takes care of everything else.

  42. First of all – awesome plugin, thanks for it.

    One Question… I excluded one category from my feed with a global function $query->set(‘cat’,’-1′)

    When I check my /feed everything is fine, posts of this category don’t appear. But PuSHPRess works different? When I check my Google Reader, I see these posts…
    Any idea how to fix this? Thanks ๐Ÿ™‚

  43. There is nothing in PuSHPress currently to support excluding specific categories, it just watches for publish events and sends the data along. To address something like this right now you’ll need to hack the plugin a bit to check for that category that you want to exclude.

  44. Will this plugin support WordPress 3.1? Thanks.

  45. I used WPMU to network activate this plugin. When I posted a test post from my main domain blog I saw that Google indexed it very quickly but for my subdomain posts it was not occurring the same way. Is there anything else I need to do?

  46. Two things that could be going on:

    1- making sure that pings are being sent out ok for your other subdomain sites
    2- ultimately Google is the one that decides what to do with the ping data, it may be that they only do rapid updates for certain sites, I don’t know

  47. Thank you for the reply. How can I verify #1 is correctly occuring?

  48. There is nothing specifically built it to do this. You can add some logging to the plugin that records all of the out going pings to make sure they are getting sent correctly.

Leave a Reply

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

© 2018 Joseph Scott

Theme by Anders NorénUp ↑