Saturday, January 24, 2009

XMPP in Client Server Application

Recently I stumbled across some readings on XMPP usage scenarios that divert from pure Instant messaging. I started some experimenting with it and I think it's really great for client-server apps as Mango is. I always had some headache with server to client notifications as RMI (and most other more modern service options) has no callback option.

I had some trouble setting up OpenFire to run embedded in my Server environment. But after two days of hazzle its finally working now. I did not want to have a standalone solution, because it would make overall installation of my server too complicated. Now it comes up with the main server process and serves the xmpp communication.

Now one of the first things I wanted to see was who's online which was quite easy after I found out that Rosters need to be registered with the JID and not anly the user name. Makes sense, but I needed some time to get it.

Then I cut of and ugly polling mechanisms for Reminder notification and replaced it with a central job on the server side that sends an xmpp Message to the client whenever a notification is available. Thats a great step forward in overall architecture to me, as simple as it looks in the first place. The clients don't need any polling any more, as they get notified whenever needed.

I tried to solve this before with a JMS approach, but XMPP looks like its much more up to the problem. The documentation I found on the Smack API is lacking many details. Next step may be to step up to ECF, but I will see if I implement some new feauters first :)