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 :)


dizz said...

Hey Tom - interesting post! :-) have you more details/pointers on embedding openfire?

Scott Lewis said...

Hi Thomas. Nice post. We (ECF) hope that you do step up to ECF...please let us know via ecf-dev at if we can help with that in any way. Also...if you would like to get involved with ECF directly (e.g. contribute an example plugin or applications) or add some specific things to ECF then please let us know!

Egon Willighagen said...

Hi Tom,

have you seen IO-DATA (XEP-0244 yet? It seems quite relevant to what you have written in this blog item... the server sending messages back is a key concept in this XEP. There is a Java implementation xws4j at SourceForge, and we have server components running with ejabberd.


Stephan said...

Wrote about Jabber/XMPP for a non-chat application:

More people should open their mind towards XMPP (good libs, stable, good servers)


Programming is hard -