views:

74

answers:

3

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

+1  A: 

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/

Mike Sherov
Its just as well, I came to ask in here.. I was thinking of writing similar my self. Thanks for the link, +1 for that !
morpheous
+2  A: 

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.

Gerbrand
A: 

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

monstru0
Hmm, only problem is that the clients I am thinking of (web browsers), can't run python AFAIK (at least NOT without a plugin - which is a whole other kettle of fish) .
morpheous
The browsers don't need to run python, they can run a javascript STOMP client for example (as long as the browsers accept web sockets). Same for the server (it can be implemented in any other language). STOMP is just a specification.The javascript STOMP clients look interesting. Here some interesting page about that: http://www.kaazing.org/confluence/display/Doc/JavaScript+STOMP+Client+How-To
monstru0