ralphm's blog

Saturday, 4 December 2004

Notifications via XMPP

Pushing it...

In a post on Examples of notifications via XMPP, melo wonders if Mimír receives updates from PubSub.com using JEP-0060. Well, it doesn't, unfortunately. But that's not because of Mimír's architecture.

If you look at the graph on the architecture page, you can see the news bot receiving pubsub notifications from the pubsub component (it uses Idavoll for this). Each channel has one pubsub node on this pubsub service, and for most channels the news items are published to their node by a RSS aggregrator using JEP-0060. The only reason is backwards compatibility: no news providers sends out news using JEP-0060, yet. So the aggregator polls the different RSS feeds and turns them in pubsub publishes.

But the aggregator is not really part of Mimír. Currently there is one channel that isn't fed using the aggregator, but publishes new items directly using JEP-0060: this blog. I've written a small python script that reads the DocBook-like source files of this blog and transforms the latest entry into a payload for the pubsub publish using XSLT, and sends it off. Every subscriber to the node is immediately notified. The only subscriber is the News bot, and it processes it further to store the item in the database, and sends all (available) channel subscribers a text notification.

If you think about that, the News bot is actually a pubsub service in itself. It accepts real JEP-0060 notifications for publishing content, and uses regular chat messages for the notification of end-users. I selectively sends those messages depending on subscriber presence, and has the side effect of marking unread items and making them available via a web interface. In fact, I intend to reimplement Mimír as an application specific implementation of a pubsub service, using Idavoll. That would allow it to send out JEP-0060 notifications to end-users, too, which could become very useful when client supports becomes available. That could be in Jabber IM clients, but dedicated desktop news readers could also be JEP-0060 powered.

So what about PubSub.com's JEP-0060 notifications? The issue here is that PubSub.com's pubsub service doesn't allow server to server connections, and therefore does not exploit the distributed nature of the Jabber network. Every user has to login to the service directly. A real pity, in my opinion. I could work around this by making a small repeater client that logs into both xmpp.pubsub.com and ik.nu, receives the notifications from the first, and then resends the payload in a new publish to pubsub.ik.nu. For now, I just aggregate the RSS feeds that PubSub also publishes using HTTP, which delays the notification to Mimír users to at most 30 minutes, the polling period of the aggregator. It feels kind of strange to have to fall back to this legacy support, though.