开发者

How to implement asynchronous request response in REST based web service

I have a REST based web service system. I need to find a way to supp开发者_如何转开发ort 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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜