Nathan Grigg

Real time publishing with Google Reader


Google Reader fetches my RSS feed about once every hour. So if I publish a new post, it will be 30 minutes, on average, before the post appears there. If I notice a typo but Google Reader already cached the feed, then I have to wait patiently until the Feed Fetcher returns. In the mean time, everyone reads and makes fun of my mistake.

Here is how to let Google Reader know that it should cache your feed now. This uses a protocol called PubSubHubbub, sometimes abbreviated PSH or PuSH.

It seems like almost no one uses PSH. Even Google, who created the protocol, apparently has forgotten about it. But Google Reader supports it, and almost everyone uses Google Reader, so that makes this useful.

1. Link your feed to a hub

Include a rel="hub" link in your feed to specify a PSH hub. Google runs one at In theory, there could be other hubs, but I don’t know of any.

If you have an Atom feed, put the following line after the feed element open tag:

<link href="" rel="hub" />

If you have an RSS feed, make sure that you first specify the Atom namespace in your rss tag:

<rss version="2.0" xmlns:atom="">

Then include the following line after the channel element [open tag]:

<atom:link href="" rel="hub" />

Now wait until the Google Bot reads your feed for the changes to take effect. Google Reader sees the link and asks the hub to notify it when the feed changes.

2. Ping the hub

Each time you publish a new post or edit a recent post, run this command at the terminal:

curl -d "hub.mode=publish&hub.url={feed_url}" ""

Of course, change {feed_url} to the URL for your feed. This command tells the hub to fetch your updated feed. The hub informs Google Reader and any other service that has asked to be notified. In my tests, it took about five seconds for the new (or updated) story to appear in Google Reader.

More information

At{feed_url}, you can see the last time the hub checked your feed.

Using PSH makes it so Google Reader polls your site less often, since it assumes you will notify them when something changes. So either go all in or don’t bother.