Is there an open source WebSockets (JavaScript) XMPP library?

Daniel S. Sterling picture Daniel S. Sterling · Dec 4, 2009 · Viewed 18.7k times · Source

Has anyone written an open source XMPP library that uses WebSockets and is meant to be run by a browser?

Answer

Makoto picture Makoto · Jan 10, 2010

There are multiple solutions (none of them are perfect)

1. Use Kaazing.

They already support it. It's open source, but they have some sort of dual license, so better to check whether you can use for your project or not.

2. Combine js.io and APE(Ajax Push Engine)

APE is a Comet framework, but they recently started supporting Websockets. At their website("APE as proxy" section), they say it can run js.io libraries which includes xmpp.js, so combining them may work.

3. Use Caucho

It is a java based framework similar to APE which provides one stop shop Comet solution, and they seem to support both XMPP and WebSockets

4. Ask Strophe team to support WebSocket.

Strophe does XMPP over BOSH(Bidirectional-streams Over Synchronous HTTP), but there is a discussion about supporting WebSockets, too.

Jack Moffitt (the core developer and the author of the book mentioned above) seems interested in WebSockets, but we need to provide more strong reasoning about why they need to support WebSocket over BOSH. If you have good answers, please join the tread.

I just tried their xmpp,bosh,strophe echobot example, which worked nicely. You might also want to try it to see if it fits your requirement or not.

For #2 and #3, they say that they both support xmpp and websockets, but not sure if they work together.

What kind of application you are thinking about using XMPP & WebSockets for?

The below are suggestions for alternatives.

  • If you want the presence, chat, chat room equivalent functionality, you could make Wave Gadget or Robot, then expose to outside using Wave Embed API(dead link, kept for historic purposes). Wave is actually built on top of XMPP.
  • If you are simply looking for very low latency messaging capability, you could try AMQP.
  • If you are looking for much simpler message streaming, you can just pipe in/out unix file as I demonstrated here.

I got most of the information above when I wrote this blog post. If you check the comment section time to time, I will post update once I find other solutions.