在 Java Servlet 中实现 Comet 哪种方式最好

发布于 2024-07-25 16:20:19 字数 230 浏览 7 评论 0原文

我想编写一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

看透却不说透 2024-08-01 16:20:19

我上周尝试了 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

双马尾 2024-08-01 16:20:19

绝对是码头!

它的“延续”方法非常出色。 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文