I am building a JSON-RPC server that accepts requests over HTTP. I would like to support bi-directional communication (both client and server can send requests), the specific use case being a publish/subscribe architecture where a client sends a subscribe(X)
request and receives changed(X)
requests in (almost) real-time. As far as I know, there are several ways to implement this with HTTP:
- long polling
- WebSockets
- polling calls using a cookie-based session model
- streaming (keeping the HTTP connection open)
- a combination of some of the above
What I'm looking for is a solution that is based on accepted internet standards (if possible), usable from a web browser and easy to work with on the client side. So far, I favour the streaming thing (Twitter, CouchDB do it that way), but I'm not sure about how well this is supported within browsers and JSON-RPC libraries. Also, there may be other ways to do it that I'm not aware of.
Thank you in advance.