PubSubHubbub Pings with Groovy!
Yes, the title does look a bit nonsensical but it isn't. PubSubHubbub is an extension of the Atom and RSS standards, providing a server-to-server, publish/subscribe communications model. The goal of the protocol is to provide near instantaneous notifications of change updates. All the major blog platforms utilize pubsubhubbub to inform search engines, feed aggregators, etc., of updates made to sites.
A server pulling your feed from the site can be configured as a hub. That server can poll hundreds or thousands of different web site feeds in order to provide a centralized location where clients can pull feeds from. Since the protocol is open, anyone can operate a hub so you have the theoretical benefit of a highly distributed series of hubs that people can point updates to or pull updates from. There aren't too many open free hubs at this point--there are several private hubs currently in operation like Superfeedr and DotSpots. The most well-known open free hub is the PubSubHubbub Reference Server.
The protocol provides a mechanism for registering a feed with a hub so that the hub does not need to waste bandwidth continually polling a site looking for updates. You do this by declaring a hub inside your feed. Typically, you would add something like the following to your atom template:
<link rel="hub" href="http://pubsubhubbub.appspot.com/" />
This registers the feed with the hub. With TypePad, all I need to do to ping the hub is publish some content like this article. With the ping, the hub will pull updates from my site and multi-cast them out to all its subscribers.
If you're interested more in what the ping looks like, below is a little script written in groovy, using httpbuilder, which issues an HTTP Post to the PubSubHubbub reference server. The post sends two parameters, "hub.mode" set to "publish" and "hub.url", which is the encoded url of your atom or rss feed. A successful ping is responded to by the hub with a 204 - No Content status code, (finally! a use for 204 status codes! :)
#!/usr/bin/env groovy import groovyx.net.http.HTTPBuilder import static groovyx.net.http.ContentType.URLENC def feedUrl = "http://blog.techstacks.com/atom.xml" def hubUrl = "http://pubsubhubbub.appspot.com" def postBody = [ "hub.mode": 'publish', "hub.url": feedUrl ] def http = new HTTPBuilder( hubUrl ) http.post( path: '/', body: postBody, requestContentType: URLENC ) { resp -> println "Server Response: ${resp.statusLine}" }