views:

93

answers:

2

I have a REST based web service system. I need to find a way to support publish/subscribe model here. As you know REST the communication between client and server is HTTP protocol. I use apache (PHP) web server in the backend to server all REST requests. The question is how to use PHP or whatever (in the web server side) to support this kind of Pub/Sub model. One typical scenario would be:

1) Client subscribes for a change in an object (GET /config/object/?type=async) 2) Client does not block with this request as it is async call. 3) Server accept the subscription and waits for the event. 4) Server publishes the client with the required data as and when the event happens.

I basically need to know how to implement all of these four steps above.

A: 

You are probably looking for something like PubSubHubbub -

http://code.google.com/apis/pubsubhubbub/

Letting PubSub implement the hub for you means you don't need blocking calls to the server.

They already have implemented example Subscribers and Publishers in different languages.

arunabhdas
A: 

If haven't already, you should read Roy Fielding's take on the various approaches to PubSub. http://roy.gbiv.com/untangled/2008/paper-tigers-and-hidden-dragons

Darrel Miller
I have read this and was not useful. They have only talked about some of the design issues and how to represent the objects. I want an implementation of this communication mechanism. Like how to notify a client from the server when an event happens.