Has anyone written an open source XMPP library that uses WebSockets and is meant to be run by a browser?
There are multiple solutions (none of them are perfect)
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.
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.
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
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.
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.