在 Java Servlet 中实现 Comet 哪种方式最好
我想编写一个使用 Comet 模式的应用程序 - 即当服务器上发生事件时可以响应的请求,而不是仅作为对即时请求的响应。
用于此目的的最简单的应用程序服务器是:
1) Tomcat 及其 NIO 包
2) Jetty 及其延续
3)或其他替代方案
我认为主要标准应该是:
- 易于使用
- 可靠性
- 速度
I want to write an aplication that uses the Comets pattern - that is a request that can be responded to when an event occurs on the server, rather than only as a response to an immediate request.
What is the easiest application server to use for this purpose, is it:
1) Tomcat with its NIO package
2) Jetty with its continutations
3) or some other alternative
I would think the main criteria should be:
- Ease of use
- Reliability
- Speed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我上周尝试了 Tomcat/NIO。 它一开始非常有前途而且很简单,但我很快就遇到了问题,因为在打开彗星请求后似乎无法将数据从客户端发送到服务器。 此外,您还需要一个自己的抽象框架来进行连接处理,以及一些让它在不同浏览器上运行的怪癖和技巧。 我忘了那件事了。
使用名为 StreamHub 的服务器或名为 Athmosphere 的框架来抽象不同的服务器。 PubSubHub...可能是另一种选择。 码头我没试过。
问候,
甘德
I tried Tomcat/NIO last week. It started out very promising adn easy, but I soon ran into problems as there seems to be no way to send data from client to server after the comet request has been opened. Also you need an own abstraction framework for connection handling and some quirks and hacks for getting it running with different browsers. I forgot about that.
Use a server named StreamHub or a framework called Athmosphere to abstract over different servers. PubSubHub... may be another option. Jetty I have not tried.
Greetz,
GHad
绝对是码头!
它的“延续”方法非常出色。 Tomcat6 的东西很糟糕,因为——谁到底想处理 NIO 事件应用程序代码?
希望能帮助到你。
Definitely Jetty!
It's "continuations" approach is brilliant. The Tomcat6' stuff sucks 'cause -- who the hell want to handle NIO events in the application code?
Hope it helps.