服务器端推送的可扩展解决方案?

发布于 2024-09-12 18:54:05 字数 284 浏览 5 评论 0原文

我想实现一种机制,提供一个 RESTful API,允许客户端向服务器注册对某个主题的兴趣,并在注册兴趣后从服务器接收异步通知。在企业(消息传递)架构中,这称为发布/订阅“模式”。

对于桌面应用程序来说,这是很容易实现的 - 但对于 Web 应用程序来说,这被证明更加困难。

是否有(最好是开源的)框架或库允许将发布/订阅模式应用于 Web 应用程序?

服务器端技术可以采用以下任何一种语言:C、C++、PHP、Python、Ruby。

我在 Linux Ubuntu 10.0.4 上运行

I would like to implement a mechanism which will provide a RESTful API that allows a client to register interest in a subject with a sever, and receive asynchronous notifications from the server after the interest is registered. In enterprise (messaging) architecture, this is known as publish/subscribe 'pattern'.

With desktop applications, this is readily acheivable - however with web applications, it is proving to be more difficult.

is there a (preferably open source) framework or library out there that allows the publish/subscribe pattern to be applied to web applications?.

Server side technology may be in any of the following languages: C, C++, PHP, Python, Ruby.

I am running on Linux Ubuntu 10.0.4

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

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

发布评论

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

评论(3

泛泛之交 2024-09-19 18:54:05

看看 pubsubhubbub 协议:http://en.wikipedia.org/wiki/PubSubHubbub

以下是该项目的来源:http://code.google.com/p/pubsubhubbub/

Have a look at the pubsubhubbub protocol: http://en.wikipedia.org/wiki/PubSubHubbub

Here is the source of the project: http://code.google.com/p/pubsubhubbub/

只为守护你 2024-09-19 18:54:05

如果您提前知道,您将有很多订阅者(人员/应用程序)想要有关某个主题的通知,而另一方面,您将很少有不同的主题考虑拉技术。

RSS、Atom 即使使用拉取也相当成功。原因是:不需要在订阅者的服务器上进行管理,以检测谁不再感兴趣(客户端长时间离线)或拥有将所有数据发送给订阅者的机制。
使用推送,您需要在服务器上做很少的事情,而客户端每次只会拉取少量数据。

拉动会花费稍多的带宽,但无论如何它都很便宜,同时它可以为您节省大量 CPU 和软件维护费用,而这是相当昂贵的。

If you know in advance you'll have a lot of subscribers (people/applications) that want notifications on a certain subject while on other hand you'll have few different subjects consider a pull technology anyway.

RSS, Atom are quite successful even though they use pull. The reason: no need to have an administration on the server of people who are subscribed, to detect who is no longer interested (client offline for a long time) or having a mechanism to get all the data out to the subscribers.
Using push, you need to do very little on the server, while the clients will only pull a small amount of data everytime.

Pull costs slightly more bandwidth that's cheap anyway while it saves you a lot on CPU and software maintanance which is quite expensive.

幻想少年梦 2024-09-19 18:54:05

我建议你看一下 STOMP 协议及其 python 客户端(我使用 < a href="http://code.google.com/p/stomppy/" rel="nofollow noreferrer">stomp.py)。这应该可以满足您的所有需求。

I suggest you take a look at STOMP protocol, and its python clients (I use stomp.py). That should suit all your needs.

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