title: Best approach for (cross-platform) real-time data streaming in PHP?
body: <p>I've been wondering how to do "true" (semi) real-time data streaming with PHP.</p>
  
  <p>Possible applications: chat rooms, auctions, games, etc.</p>
  
  <p>By "true", I mean the data is not just written somewhere and polled continuously, but actually streaming to the client somehow.</p>
  
  <p>By "semi", I mean it's okay if only the stream from the server to the client is real-time, and messages from the client to the server are not.</p>
  
  <p>For the communication between the client and server, I'd like to stick with plain HTTP (AJAX) rather than some other protocol.</p>
  
  <p>Streaming to the client with HTTP is possible by manually flushing the output buffer.</p>
  
  <p>The question is what to connect that script to on the server-side?</p>
  
  <p>And once it's connected, to do a blocking read, rather than polling for changes.</p>
  
  <p>The shared memory (shmop) extension would work, but it's not cross-platform.</p>
  
  <p>Perhaps memcached would work? But I'm not sure if there's a way to do a blocking read, so it comes down to polling again - although I'm sure memcached is pretty fast, I just don't like the idea of continuous polling.</p>
  
  <p>Any ideas?</p>