title: Server Side or Client Side Long Polling?
body: <p>What are best practices for <code>long polling</code>?</p>
  
  <p>Currently what I have set up is <code>javascript</code> making an <code>xmlhttprequest</code> to a <code>server</code> with <code>PHP</code> running server side checking if there is anything new and return new content or no new content variable. Then client side will wait for <code>n</code> seconds after receiving the returned value before making another request.</p>
  
  <p>But I'm seeing a lot online with a different approach, that if the <code>server</code> does not have anything new <strong>don't</strong> return just yet instead wait for <code>n</code> seconds and check again for new content until a certain number of attempts then return new content or no new content and the client side makes a new request right after receiving the returned value.</p>
  
  <p>So with the above 2 which one would be the best approach to give less strain on a server or maybe conserve more server resources? My current setup or the 2nd setup? Or maybe a different approach?</p>
  
  <p>Thanks!</p>