A web application I'm helping to develop is faced with a well-known problem: we want to be able to let users know of various events and so forth that can occur at any time, essentially at random, and update their view accordingly. Essentially, we need to allow the server to push requests to individual clients, as opposed to the client asking the server.
我正在帮助开发的Web应用程序面临一个众所周知的问题:我们希望能够让用户随时了解可能发生的各种事件,基本上是随机的,并相应地更新他们的视图。从本质上讲,我们需要允许服务器将请求推送到单个客户端,而不是客户端询问服务器。
I understand that WebSockets are an effort to address the problem; however, after a bit of looking around into them, I understand that a) very few web browsers currently offer native websocket support; b) to get around this, you either use flash sockets or some sort of AJAX long-polling; c) a special websockets server must be used.
我知道WebSockets是解决这个问题的努力;但是,经过一番调查后,我明白了a)很少有网络浏览器目前提供原生的websocket支持; b)要解决这个问题,你可以使用闪存套接字或某种AJAX长轮询; c)必须使用特殊的websockets服务器。
Now, we want to offer our service without Flash. And any sort of servers must have some sort of load-balancing capabilities, or at least some software that can do load balancing for them.
现在,我们想要提供没有Flash的服务。任何类型的服务器都必须具有某种负载平衡功能,或者至少是一些可以为它们进行负载平衡的软件。
As of 2008, everyone was saying that Comet-based solutions (e.g., Bayeux) were the way to go for these sort of situations. However, the various protocols seem to have not had much work put into them since then—which leads (finally) to the question.
截至2008年,每个人都在说基于Comet的解决方案(例如,Bayeux)是这种情况的出路。然而,从那时起,各种协议似乎没有做太多工作 - 这导致(最终)问题。
Is Bayeux-flavored Comet still the right tool for jobs like this? If not, what is?
Bayeux风味的Comet仍然是这样的工作的合适工具吗?如果不是,那是什么?
2 个解决方案
#1
1
An alternative to Comet/Bayeux that has proven to be working is the combination of an XMPP server such ejabberd or OpenFire and StropheJS developed by Jack Moffitt (his website is http://metajack.im/). The limitation of XMPP is it can only transports text and not binary payload.
已被证明有效的Comet / Bayeux的替代品是由Jack Moffitt开发的XMPP服务器(如ejabberd或OpenFire)和StropheJS(他的网站为http://metajack.im/)的组合。 XMPP的局限性在于它只能传输文本而不能传输二进制有效负载。
#2
0
WebSockets sounds like the ideal solution to your problem - I would not recommend going the comet/bayeux path. Regarding your first two concerns:
WebSockets听起来像是你问题的理想解决方案 - 我不建议你去彗星/拜耳路径。关于你的前两个问题:
a) very few web browsers currently offer native websocket support
a)目前很少有Web浏览器提供原生websocket支持
WebSocket servers tend to offer emulation techniques for browser that don't have native WebSocket support. Here you can read about the emulation that one of the vendors, Kaazing offers [disclaimer: I work for Kaazing].
WebSocket服务器倾向于为没有本机WebSocket支持的浏览器提供仿真技术。在这里,您可以阅读其中一家供应商Kaazing提供的仿真[免责声明:我为Kaazing工作]。
b) [WebSocket emulation uses] flash sockets or some sort of AJAX long-polling
b)[WebSocket仿真使用]闪存套接字或某种AJAX长轮询
Not quite the case. Doing emulation well is not simple, but it can be done. Long polling is pretty much the last resort. The Kaazing Gateway, for example, always uses better emulation than long polling.
情况并非如此。做好仿真并不简单,但可以做到。长期投票几乎是最后的选择。例如,Kaazing Gateway总是使用比长轮询更好的仿真。
Kaazing also offers an XMPP edition of the WebSocket Gateway, allowing you to build an HTML5 app using XMPP from your JavaScript environment directly. The underlying transport layer of XMPP is WebSockets (native or emulated).
Kaazing还提供了WebSocket Gateway的XMPP版本,允许您直接在JavaScript环境中使用XMPP构建HTML5应用程序。 XMPP的底层传输层是WebSockets(本机或模拟)。
#1
1
An alternative to Comet/Bayeux that has proven to be working is the combination of an XMPP server such ejabberd or OpenFire and StropheJS developed by Jack Moffitt (his website is http://metajack.im/). The limitation of XMPP is it can only transports text and not binary payload.
已被证明有效的Comet / Bayeux的替代品是由Jack Moffitt开发的XMPP服务器(如ejabberd或OpenFire)和StropheJS(他的网站为http://metajack.im/)的组合。 XMPP的局限性在于它只能传输文本而不能传输二进制有效负载。
#2
0
WebSockets sounds like the ideal solution to your problem - I would not recommend going the comet/bayeux path. Regarding your first two concerns:
WebSockets听起来像是你问题的理想解决方案 - 我不建议你去彗星/拜耳路径。关于你的前两个问题:
a) very few web browsers currently offer native websocket support
a)目前很少有Web浏览器提供原生websocket支持
WebSocket servers tend to offer emulation techniques for browser that don't have native WebSocket support. Here you can read about the emulation that one of the vendors, Kaazing offers [disclaimer: I work for Kaazing].
WebSocket服务器倾向于为没有本机WebSocket支持的浏览器提供仿真技术。在这里,您可以阅读其中一家供应商Kaazing提供的仿真[免责声明:我为Kaazing工作]。
b) [WebSocket emulation uses] flash sockets or some sort of AJAX long-polling
b)[WebSocket仿真使用]闪存套接字或某种AJAX长轮询
Not quite the case. Doing emulation well is not simple, but it can be done. Long polling is pretty much the last resort. The Kaazing Gateway, for example, always uses better emulation than long polling.
情况并非如此。做好仿真并不简单,但可以做到。长期投票几乎是最后的选择。例如,Kaazing Gateway总是使用比长轮询更好的仿真。
Kaazing also offers an XMPP edition of the WebSocket Gateway, allowing you to build an HTML5 app using XMPP from your JavaScript environment directly. The underlying transport layer of XMPP is WebSockets (native or emulated).
Kaazing还提供了WebSocket Gateway的XMPP版本,允许您直接在JavaScript环境中使用XMPP构建HTML5应用程序。 XMPP的底层传输层是WebSockets(本机或模拟)。