Java 中的 Comet HTTP 模式

发布于 2024-08-21 00:11:41 字数 262 浏览 2 评论 0原文

我正在将 C++ HTTP 事件服务器编写/移植到 Java。我想知道使用 Jetty、Tomcat、任何其他服务器或本机实现 comet 的最佳范例是什么。

  • 线程
  • 延续
  • NIO
  • Servlet 3.0

可扩展性是绝对必须的,因为我正在开发一个新协议,每个客户端最多使用 3 个并发连接。

任何帮助表示赞赏。

PS:如果可能的话,我也希望看到一些示例代码或教程。

I'm writing/porting a C++ HTTP event server to Java. I'm wondering what are the best paradigms for implementing comet with Jetty, Tomcat, any other server, or natively.

  • Threaded
  • Continuations
  • NIO
  • Servlet 3.0

Scalability is an absolute must as I'm developing a new protocol that uses up to 3 concurrent connections per client.

Any help is appreciated.

PS: If possible, I would love to also see some sample code or tutorials..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

岁月苍老的讽刺 2024-08-28 00:11:42

我们通过 Caucho Resin 的 LongPoll 取得了很大成功功能(我们 UI 的大部分数据都来自 Comet)。 Caucho 还添加了对 WebSockets 的支持,所以如果您有HTML 5 客户端您也可以从中受益。

在 Linux 上,他们有一些自定义 JNI 代码,可以直接与 epoll 对话,这使得服务器可以很好地扩展。

We've had a lot of success with Caucho Resin's LongPoll features (the majority of the data to our UI comes in over Comet). Caucho has also added support for WebSockets, so if you have an HTML 5 client you can benefit there too.

On Linux they have some custom JNI code that talks directly to epoll, which allows the server to scale well.

清引 2024-08-28 00:11:42

Glassfish 有本地彗星支持,我认为 Glassfish 团队在 tomcat 中存在对彗星支持的 WAR。 Jetty 似乎也处于领先地位。我是否误解了,但是你为什么要尝试在 Java 应用程序服务器中重新实现 comet 呢?

Glassfish has native comet support and I thought there was WAR for comet support in tomcat from the Glassfish team. Jetty also seems to be leading the crowd. Am I misunderstanding, but why are you trying to re-implement comet in a Java app Server?

〆凄凉。 2024-08-28 00:11:42

或者你可以放弃 Comet 并使用 WebSockets: http://www.jWebSocket.org

Or you can drop Comet and go WebSockets: http://www.jWebSocket.org

缘字诀 2024-08-28 00:11:42

过去几天我一直在研究彗星。我的公司在开发中使用 Tomcat,在生产中使用 WebLogic。我们希望在不改变现有应用程序的情况下合并 Comet。 Atmosphere 的 API 给我留下了深刻的印象。它专注于服务器端,允许可移植性,同时利用 NIO 等本机服务器功能。他们似乎每个月都会发布更新。
https://atmosphere.dev.java.net/

I've been looking into Comet myself the past couple days. My company uses Tomcat in development and WebLogic in production. We'd like to incorporate Comet without shaking up our existing application. I've been impressed with Atmosphere's APIs. It focuses on the server side, allowing for portability while taking advantage of native server features like NIO. They seem to be putting out updates every month.
https://atmosphere.dev.java.net/

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