title: How do I implement basic "Long Polling"?
body: <p>I can find lots of information on how Long Polling works (For example, <a href="http://jfarcand.wordpress.com/2007/05/15/new-adventures-in-comet-polling-long-polling-or-http-streaming-with-ajax-which-one-to-choose/" rel="noreferrer">this</a>, and <a href="http://en.wikipedia.org/wiki/Comet_(programming)#Ajax_with_long_polling" rel="noreferrer">this</a>), but no <em>simple</em> examples of how to implement this in code.</p>
  
  <p>All I can find is <a href="http://code.google.com/p/cometd/" rel="noreferrer">cometd</a>, which relies on the Dojo JS framework, and a fairly complex server system..</p>
  
  <p>Basically, how would I use Apache to serve the requests, and how would I write a simple script (say, in PHP) which would "long-poll" the server for new messages?</p>
  
  <p>The example doesn't have to be scaleable, secure or complete, it just needs to work!</p>