title: Long polling in node.js - how to 'timeout' the pending requests if no data is available?
body: <p>I'm trying to implement an http long polling server in Node.js, and have no idea how to close/shutdown pending requests if a timeout is reached.</p>
  
  <p>3 possible solutions come to my mind:</p>
  
  <ol>
  <li>Store the pendingRequest with a timestamp in a hash/object, then call setIntervall, so that every 1/2/x secs the pendingRequests are removed if the timestamp is too old.</li>
  <li>set a timeout on the socket connection</li>
  </ol>
  
  <p>Both solutions don't seem very reasonable, so what would be the Node.js way to achieve something like this?</p>