title: Exception ETIMEDOUT in node.js
body: <p>I write application for iOS, which uses Socket.IO. Sometimes my server JS-script falls with this error:</p>
  
  <pre><code>events.js:85
        throw er; // Unhandled 'error' event
              ^
  Error: connect ETIMEDOUT
      at exports._errnoException (util.js:746:11)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:983:19)
  </code></pre>
  
  <p>What I know is:</p>
  
  <ul>
  <li>Script workes fine when I use only application for Android. That app uses Socket.IO for Android</li>
  <li>Script workes fine when I use only web-client (yeap, with socket.IO)</li>
  <li>Script startes to fall when I use iOS app.</li>
  <li>Crash happens not always and not right away. Script falls after 5-10 minutes after connection and may crash, but may not.</li>
  </ul>
  
  <p>So, I think the problem is in server library for socket.io, but exception fires only when iOS-client connecting.</p>
  
  <p>How can I handle this exception?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>There is problem was in the OAuth module on my node.js-server, which tried to check app token but had timeout to vk.com
  I've edited vkapi module in my node.js server by adding "on" event for "https.get" function:
  Was:</p>
  
  <pre><code>https.get(options, function(res) {
  
              var apiResponse = new String();
              res.setEncoding('utf8');
  
              res.on('data', function(chunk) {
                  apiResponse += chunk;
              });
  
              res.on('end',  function() {
                  var o = JSON.parse(apiResponse);
                  if (o.error) { self.emit('appServerTokenNotReady', o);
  
                  } else { 
                      self.token = o.access_token;
                      self.emit('appServerTokenReady');
                  }
              });
          });
  </code></pre>
  
  <p>Now:</p>
  
  <pre><code>https.get(options, function(res) {
  
              var apiResponse = new String();
              res.setEncoding('utf8');
  
              res.on('data', function(chunk) {
                  apiResponse += chunk;
              });
  
              res.on('end',  function() {
                  var o = JSON.parse(apiResponse);
                  if (o.error) { self.emit('appServerTokenNotReady', o);
  
                  } else { 
                      self.token = o.access_token;
                      self.emit('appServerTokenReady');
                  }
              });
          }).on('error', function(e) {
              console.log('HTTPS error');
          });
  </code></pre>