[jdev] HTTP gateway

Theo Cushion theo at jivatechnology.com
Thu May 20 08:08:21 CDT 2010


We've been building a web app which uses XMPP under the covers to send  
out updates realtime to in-browser clients for a little while now -  
and are really pleased with the results. We make extensive usage of a  
number of features including Pubsub and PEP. This requires a lot of  
configuration of these nodes as users signup or change details via the  

This means the web app has to send out these configuration messages on  
behalf of the users (business logic we want to hide - and in the  
interests of keeping the client simple). Due to the asynchronous  
nature of XMPP this makes for quite a different programming style  
under the hood to ensure everything has worked smoothly - or adopt a  
very naive approach of fire and forget.

I keep seeing solutions to this type of thing involving custom  
ejabberd modules and the like - but this tends to result in lock in  
and makes support difficult (what happens when ejabberd internals get  
updated), we also loose features like decentralisation. It is proving  
a problem for us in that the 'best practice' for writing this type of  
code is totally unknown - and concepts familiar to web developers are  

An idea I have been toying with for a while is an HTTP gateway that  
operates in a similar way to RESTful services ( please forgive  
me :-) ), for operations which typically involve IQ stanzas and  
dataforms where we care a lot that they get done correctly - and less  
so about using the most efficient transport.

While doing a bit of research I've come across a number of resources:

- http://idavoll.ik.nu/wiki/HTTP_Interface shows exactly what I was  
thinking of - but aimed solely at Pubsub (a damn good start), although  
it doesn't seem to have been touched in 2 years.
- http://xmpp.org/extensions/xep-0060.html#registrar-querytypes gives  
out a URI structure that could be used as a well defined way of  
building the RESTful HTTP service
- http://xmpp.org/extensions/xep-0099.html provides a very consistent  
framework that would map very nicely onto RESTful HTTP service
- http://xmpp.org/extensions/xep-0147.html more information on URI's

So what I propose is building a HTTP service which provides a  
convenient interface for configuring XMPP servers. This would probably  
use HTTP basic access authentication to deal with login and then build  
upon the URI's specified in the XEP's to provide a very simple  
synchronous interface which other application developers can hook into  
and still allow them to use all of the awesome XMPP features - but  
control it in a way they find easy.

What are peoples thoughts / criticisms / suggestions?



More information about the JDev mailing list