Pubsubhubbub へ Ping を飛ばす
2010-07-31 12:34 JST @sadayuki Tweet前に使っていた Tokyo Promenade は、Ping を Pubsubhubbub の デモサーバ へ飛ばしていた。なので、この Blog もデモサーバへ Ping を飛ばしたい。
デモサーバの Publish の画面には、「Topic: (the feed URL)」の入力欄と、「Publish」のボタンしかない。この URL の欄に、Atom Feed の URL を入力して Publish ボタンを押せば Ping 完了である。毎回これをやる気になれば、これで終わり。
ここの Form は次のようになっている。
<h1>Publish</h1>
<form action="/publish" method="post" accept-charset="utf-8">
<input type="hidden" name="hub.mode" value="publish"/>
<p>
<label for="topic">Topic: <em>(the feed URL)</em></label>
<input type="text" name="hub.url" value="" size="50" id="topic">
</p>
<p><input type="submit" value="Publish"></p>
</form>
<em>Note: submission will result in a HTTP 204 response to acknowledge; in browsers this looks like a no-op</em>
なので、https://pubsubhubbub.appspot.com/publish/?hub.mode=publish&hub.url=http://www.kurano.jp/blog/sadayuki/feed.atom へ POST するのと同じこと。ちょっと気になるのは https なのと、URL エンコードが必要なくらい。まあ、ブラウザから実行するなら問題無し。
こうして Publisher が Hub に対して 新しい記事の通知 を行うと、Hub が通知された URL に 記事の取得 に来る。次に Hub が、Subscriber に取得した 記事を配布 する。
あともう一つ気になるのが、Atom Feed の中身。いまの Blog では、常に最新の 20 件を返してしまっている。もしかして、Ping する URL に記事の id を振るとかして、新しい記事のみ返したほうが良いのかも。要検討。