XMPP BOSH和COMET [英] XMPP BOSH vs COMET

查看:101
本文介绍了XMPP BOSH和COMET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个实时聊天应用程序,并且需要确定要使用哪些技术。



这些技术之间有什么区别,您更喜欢哪种?为什么?



WebSockets不是一种选择,因为它还没有准备好在野外战斗



谢谢

解决方案

您应该阅读问题。


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, since 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:

You can find a list of realtime technologies here.

这篇关于XMPP BOSH和COMET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆