Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 803
Daniel S. Sterling Avatar asked Dec 04 '09 22:12

Daniel S. Sterling


People also ask

How do you know if a WebSocket is closed?

You can check if a WebSocket is disconnected by doing either of the following: Specifying a function to the WebSocket. onclose event handler property, or; Using addEventListener to listen to the close event.

Are WebSockets still used?

For now, I think there are plenty of applications already using Websocket. And there are many frameworks developed for Websockets in almost all the programming languages. They are very matured as well. Only caveat developers may think of Websocket is that, the fact that it's not HTTP.

What is the difference between WebSocket and WebRTC?

WebSocket provides a client-server computer communication protocol, whereas WebRTC offers a peer-to-peer protocol and communication capabilities for browsers and mobile apps. While WebSocket works only over TCP, WebRTC is primarily used over UDP (although it can work over TCP as well).

Does gRPC use WebSockets?

However, it's important to note that if the user wishes to use WebSockets, then the downgrading handler must be used, as traditional gRPC servers do not support WebSockets.


2 Answers

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.

  • XMPP JavaScript How-To

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.

  • 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 support both XMPP and WebSockets

  • Caucho Resin
  • Caucho Websocket example with Resin

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.

like image 113
Makoto Avatar answered Oct 11 '22 19:10

Makoto


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.

Edit: Jack Moffitt has written an IETF Internet-Draft with a first pass at a protocol that can be used. WARNING. This is still likely to change drastically. Only implement it if you're willing to rip it out completely later. WARNING.

like image 41
Joe Hildebrand Avatar answered Oct 11 '22 19:10

Joe Hildebrand