开发者

XMPP BOSH vs COMET

I want to write a real-time chat application and in need to decide which technologies to use.

What are the differences between these technologies and which do you prefer and why?

WebSockets in not an option, sinc开发者_如何转开发e its not ready to fight in wild

Thanks


You should read the question "Why isn't BOSH more popular especially as an alternative to WebSockets and Long-Polling". kanaka gives a fantastic answer and I'm sure it'll address the concerns you have about WebSockets. WebSocket are absolutely "ready to fight in the wild".

BOSH and Comet, in my opinion, are the same thing. BOSH stands for "Bidirectional-streams Over Synchronous HTTP" and although the BOSH specification states:

BOSH, the technology defined in this specification, essentially provides a "drop-in" alternative to a long-lived, bidirectional TCP connection. It is a mature, full-featured technology that has been widely implemented and deployed since 2004. To our knowledge it was the first of many similar technologies, which now include the Comet methodology formalized in the Bayeux Protocol as well as The Web Socket Protocol and Reverse HTTP.

I know for a fact that Comet servers have been around since at least 2001, since I worked for a company (Caplin Systems) who had, and still have, a Comet server.

The reason I say that they are the same thing, at a fundamental level, is that they both originally (see below) relied upon two HTTP connections. The first is a back channel which is either a long-held HTTP Streaming connection or use for HTTP Long-Polling. The second connection is short-lived and used for sending commands such as subscription requests. These two connections allowed for the bi-directional communication to be simulated.

So, at a fundamental level BOSH and Comet use the same mechanisms for server to client and client to server communication (client being a web browser or other supported web client). Where BOSH differs is it offers added detail within it's protocol and was developed with XMPP in mind. Any Comet server could be developed to adhere to the standards defined in the BOSH spec.

All this said, Comet and BOSH servers will undoubtedly offer alternative transport mechanisms. These will include HTTP Streaming, HTTP Long-Polling, standard HTTP-Polling and WebSockets.

So, if you want the detail that is provided by BOSH and XMPP then you probably want to consider a technology stack built with BOSH and XMPP in mind. If you want to send simple messages, without that added payload inherent in BOSH and XMPP, or if you want to build your own 'added value' to your own protocol then something labelled as a Comet server is probably a better solution.

If you choose to use an existing technology stack, rather than develop a solution from the ground up, then it's highly likely that the solution will use WebSockets were possible since they offer a standardised and efficient bi-directional communications mechanism.

I've made my first attempt at a realtime web technology stack diagram which you can see below. Hopefully it helps a bit:

XMPP BOSH vs COMET

You can find a list of realtime technologies here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜