What are the best ways for a web service to notify a client about new data available?
A server is a PHP RESTful web service, a client can be an AJAX GUI or a desktop Java application. A client has to update presentation as soon as a web-service-provided value changes. How to implement thi开发者_开发知识库s? Polling a web service from time to time does not seem an efficient solution, IMHO. A web service has to be able to notify a subscriber about update events some way. What are common best practices for this case?
A web service isn't generally something that notifies its clients. "Polling from time to time ", as you've said, is a working solution - RSS seems right for your scenario (or any other form of XML or even JSON, which your service is already outputing).
If you want your clients to react to server events, you probably need something stronger than a web service.
精彩评论