Has anyone written an open source XMPP library that uses WebSockets and is meant to be run by a browser?
There's a book coming soon that covers this topic...
Professional XMPP with JavaScript and jQuery
But I'm assuming you don't want to wait for the book. So watch the Jack Moffitt's presentation from JSConf. I watched it this morning. (Jack Moffitt is the author of the book linked to above.)
The library involved (JavaScript and C implementations) is Strophe.
This is a very fruitful area of exploration, but very raw. We'll see more soon. WebSockets come with HTML5, is that right?
We don't yet have a standard for XMPP over WebSockets that the servers can implement, which will be required before the client side can be tackled adequately.
The first step is to finish WebSocket standardization. It looks like this may happen in an IETF HyBi working group, which at the time of writing has not yet been approved by the IESG. There was a HyBi Birds-of-a-Feather (BoF) at the Hiroshima IETF meeting a couple of weeks ago (see the meeting materials), which went pretty well.
After WebSockets has a stable reference, and seems to be settling down, the XSF will create a XEP that binds XMPP to WebSockets, presumably with a stanza per WebSocket frame.
Hi, 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.
(http://www.kaazing.org/confluence/display/Doc/XMPP+JavaScript+How-To)
(http://www.kaazing.org/confluence/display/KAAZING/License)
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.
- (http://www.ape-project.org/wiki/index.php/How_to_write_an_application_with_APE)
3. Use Caucho
It is a java based framework similar to APE which provides one stop shop Comet solution, and they seem to xupport both XMPP and WebSockets
- (http://java.dzone.com/announcements/caucho-releases-resin-320)
- (http://www.caucho.com/resin/examples/websocket-java/index.xtp)
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.
- (http://groups.google.com/group/strophe-dev/browse_thread/thread/c6b555ac5f84fc5f/30ba98ee90769d16)
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 (h[ttp://gist.github.com/272956][1]), and 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([http://code.google.com/apis/wave/guide.html][2]). Wave is actually built on top of XMPP.
- If you are simply looking for very low latency messaging capability, you could try amqp ([http://blog.0x82.com/2009/12/28/twitter-amqp-websocket-example-no-polling][3]).
- If you are looking for much simpler message streaming, you can just pipe in/out unix file as I demonstrated here ([http://blog.new-bamboo.co.uk/2009/12/14/pushing-the-boundary-of-real-time-web-with-twitter-and-xfactor][4]).
I got most of the information above when I wrote this blog post ([http://blog.new-bamboo.co.uk/2009/12/30/brain-dump-of-real-time-web-rtw-and-websocket][5]). If you check the comment section time to time, I will post update once I find other solutions.
NOTE: Since I don't have enough reputation yet, I could not put hyper links to all resources.
Maybe this link helps:
http://xmpp.org/software/libraries.shtml#javascript
it is a list of open source implementations of XMPP in Javascript.
poking around and found this http://xmppjs.prosody.im/ . Haven't checked it out any further but claims it does it.
I'm not sure JS on browser side can handle websocket protocol alone as it mostly rely on browser API. Few browser support websocket yet: Chrome, Safari5, maybe Firefox4. There are many workarounds based on flash/as3 (then your js communicates with flash code) the the main limitation is that flash does not support secure connection (too bad).
BWT, you can check this websocket implem they provide opensource Java websocket client lib and seems to deal with xmpp stuff and if you browse the repositories you might find basic as3 websocket implementation.