彗星和 jQuery

发布于 2024-07-07 06:17:12 字数 154 浏览 8 评论 0原文

我对使用 javascript 进行服务器推送进行了一些研究,并发现普遍的共识是我正在寻找的东西在于“Comet”设计模式。 是否有基于 jQuery 构建的这种模式的良好实现? 如果没有,这种模式有什么好的实现吗? 无论这些问题的答案如何,从实现的角度来看,是否有关于此模式的任何文档?

I've done some research into server push with javascript and have found the general consensus to be that what I'm looking for lies in the "Comet" design pattern. Are there any good implementations of this pattern built on top of jQuery? If not, are there any good implementations of this pattern at all? And regardless of the answer to those questions, is there any documentation on this pattern from an implementation stand-point?

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

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

发布评论

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

评论(8

Bonjour°[大白 2024-07-14 06:17:12

我写了 Till 提到的插件。 该插件是 Bayeux 协议的实现,目前支持长轮询(通过 AJAX 的本地服务器)和回调轮询(通过 XSS 的远程服务器)。 有一个名为 cometd-twisted 的 Python Bayeux 实现,我听说我的插件可以使用它,但是我还没有验证这一点。 我已经测试并验证它可以与 cometd-jettyerlycomet 其中包含 jQuery Comet 示例。 我的 博客 上有更多信息,并且可以在其 Google 代码页。 希望这些信息对您有所帮助,如果需要有关该插件的任何进一步帮助,请随时与我联系。

I wrote the plugin mentioned by Till. The plugin is an implementation of the Bayeux protocol and currently supports long-polling (local server via AJAX) and callback-polling (remote server via XSS). There is a Bayeux implementation for Python called cometd-twisted that I have heard my plugin works with, but I have not verified this. I have tested and verified it works with cometd-jetty and erlycomet which has a jQuery Comet example included. There is more info on my blog and the current code with a basic chat example can be found on its google code page. Hope this info is helpful and feel free to contact me if need any further help with the plugin.

十六岁半 2024-07-14 06:17:12

有人使用 jQuery 构建了 Comet 客户端。 我不知道它是否有什么好处。 我读过有关 Comet 的文章,也听说过它的所有好处,但我从未抽出时间使用它。 只是没有时间,也没有在我当前的项目中使用案例。

我完全忘记添加一个关于实现彗星的链接。

有 Comet Daily,他们在网上进行了比较。 比较强调不同实施的成熟度。 这非常有趣,应该可以帮助您入门。

希望有帮助!

Someone built a client for Comet using jQuery. I don't know if it's any good though. I've read about Comet and heard about all the good it can do, but I have never gotten around to using it. Just had no time and no use case on any of my current projects.

I totally forgot to add a link as for implementing comet.

There is Comet Daily and they have a comparison online. The comparison emphasizes on maturity of the different implementation. It's pretty interesting and should get you started.

Hope that helps!

滥情哥ㄟ 2024-07-14 06:17:12

查看 Ape 项目,了解实现彗星模式的完整客户端和服务器端解决方案。

Check out the Ape Project for a complete client and server side solution that implements the comet pattern.

雪化雨蝶 2024-07-14 06:17:12

Comet 是一个很棒的解决方案,并且有各种各样的实现。 哪一种取决于您的需求。

我们为 IIS/ASP.NET 实现了一个解决方案,WebSync。 它包括 javascript 客户端,可以很好地与 jQuery 配合使用。 从技术上讲,由于它是 Bayeux 协议,因此任何 Bayeux 客户端都应该正常工作。 在 dojo 库中也可以找到相同的协议。

有关更多详细信息,您可以查看Bayeux 协议的规范。

Comet is a great solution, and there are all kinds of implementations. Which one depends on your needs.

We've implemented a solution for IIS/ASP.NET, WebSync. It includes the javascript client, which plays nicely with jQuery. Technically, since it's the Bayeux protocol, any Bayeux client should work just dandy. The same protocol can also be found in the dojo library.

For more detail, you can see the spec for the Bayeux protocol.

折戟 2024-07-14 06:17:12

我这里有一个非常简单的例子,可以帮助您开始使用 comet。 它涵盖了使用 NHPM 模块编译 Nginx,并包含 jQuery、PHP 和 Bash 中简单发布者/订阅者角色的代码。

http://blog.jamieisaacs.com/2010 /08/27/comet-with-nginx-and-jquery/

可以在这里找到一个工作示例(简单的聊天):
http://cheetah.jamieisaacs.com/

I have a very simple example here that can get you started with comet. It covers compiling Nginx with the NHPM module and includes code for simple publisher/subscriber roles in jQuery, PHP, and Bash.

http://blog.jamieisaacs.com/2010/08/27/comet-with-nginx-and-jquery/

A working example (simple chat) can be found here:
http://cheetah.jamieisaacs.com/

花桑 2024-07-14 06:17:12

看看socket.io。 相信我。 这正是医生所吩咐的。

http://socket.io

使用 Node.js 传输数据

Look at socket.io. Trust me. This is exactly what the doctor ordered.

http://socket.io

Stream data with Node.js

幻想少年梦 2024-07-14 06:17:12

如果您使用 JQuery,我推荐 jquery-stream。 我目前正在一个项目中使用 jquery-stream,到目前为止它是可靠的、有详细记录的并且有一个活跃的 Google 代码项目。

http://code.google.com/p/jquery-stream/

If you're using JQuery, I'd recommend jquery-stream. I'm currently using jquery-stream on a project and so far its been reliable, well-documented and has an active Google code project.

http://code.google.com/p/jquery-stream/

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