title: node.js async request with timeout?
body: <p>Is it possible, in node.js, to make an asynchronous call that times out if it takes too long (or doesn't complete) and triggers a default callback?</p>
  
  <p>The details:</p>
  
  <p>I have a node.js server that receives a request and then makes multiple requests asynchronously behind the scenes, before responding. The basic issue is covered by an <a href="https://stackoverflow.com/questions/18008479/node-js-wait-for-multiple-async-calls">existing</a> question, but some of these calls are considered 'nice to have'. What I mean is that if we get the response back, then it enhances the response to the client, but if they take too long to respond it is better to respond to the client in a timely manner than with those responses.</p>
  
  <p>At the same time this approach would allow to protect against services that simply aren't completing or failing, while allowing the main thread of operation to respond.</p>
  
  <p>You can think of this in the same way as a Google search that has one core set of results, but provides extra responses based on other behind the scenes queries.</p>