title: Real-time bi-directional JSON-RPC communication over HTTP
body: <p>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 <code>subscribe(X)</code> request and receives <code>changed(X)</code> requests in (almost) real-time. As far as I know, there are several ways to implement this with HTTP:</p>
  
  <ul>
  <li>long polling</li>
  <li>WebSockets</li>
  <li>polling calls using a cookie-based session model</li>
  <li>streaming (keeping the HTTP connection open)</li>
  <li>a combination of some of the above</li>
  </ul>
  
  <p>What I'm looking for is a solution that is based on accepted internet standards (if possible), usable from a web browser and <em>easy to work with on the client side</em>. 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.</p>
  
  <p>Thank you in advance. </p>