Dele Olajide

WebSockets Connection Manager for Openfire

Blog Post created by Dele Olajide Champion on Sep 15, 2011

This is an implementation of WebSockets for the Openfire XMPP server. It consists a plugin for Openfire and a low-level JavaScript library suitable to be used with jQuery.



Recently, I have been involved in shaping an XMPP protocol extension (XEP) for simple application remote control of telephony devices for financial trading systems. This XEP is called Openlink and is still evolving.


I use XMPP Bosh to provide an Openlink Javascript library for web based applications and I am seeking to improve performance and scalability beyond the limitations of long-polling BOSH connections, so I decided to investigate replacing BOSH with Websockets in my Openlink Javascript library.

What did you do?

The Websocket protocol is close to finalising and Jetty (the embedded web server for Openfire) has been supporting WebSocket since Nov 2009 in version 7.0.1 which is the Jetty version in current Openfire 3.7.0. My first attempt of using the Jetty WebSocketServelet? class from Openfire 3.7.0 with Google Chrome web browser failed and I am not sure why. The WebSockets specification has changed a lot over the last two years and both Chrome and Jetty have kept up with it, so I was not surprised.


I therefore decided to recompile Openfire from SVN (version 3.7.1 Alpha) with latest Jetty 7.5.1 and finally got it working.



I then implemented a very thin XMPP stanza based Javascript class called openfire-websockets which exposes a minimium "Stophe" like connection object which I tested with the XMPP console application in chapter 4 of the book "Professional XMPP Programming with JavaScript and jQuery" by Jack Moffitt.





You can use this plugin from Openfire 3.7.0. Just replace openfire.jar and slf4j-log4j12.jar in OPENFIRE_HOME\lib.

Should I?

If you do most of your application development with XMPP like I do, using Openfire and need fast and simple access to the low level XMPP messages as DOM elements in Javascript from JQuery right now, then take a look at openfire-websockets.js