Have you ever worked with XMPP or ejabberd? First things first: both things are great! The XMPP protocol is very robust, extensible and well documented. ejabberd on the other hand is a scalable and easy to use messaging server which implements the XMPP protocol. And we extended it for our custom needs.