title: Node.JS + socket.io + IIS = ECONNRESET
body: <p>I am running a SSL socket on port 8081. While this works perfectly with Apache2.4, after a while on IIS, socket.io crashes with ECONNRESET, which never happens with Apache. My socket.io version is 1.3.7. IIS is v10 (windows server 2016).</p>
  
  <p>I've added some error handling as recommended but it does not solve the issue. Here is a sanitized code.</p>
  
  <pre><code>var options = {
    key: fs.readFileSync('example.key'),
    cert: fs.readFileSync('example.cert'),
    ca: fs.readFileSync('example.inter')
  };
  
  var app = require('https').createServer(options),
  io = require('socket.io').listen(app);  
  io.set('origins', '*:8081');
  app.on('error', function(error){
      console.log('error', error);
  });
  app.listen(8081);
  
  io.sockets.on('connection', function(__socket) {
  
       __socket.on('error', function(){
            __socket.destroy();
       });
  
       __socket.on('disconnect', function(){
            __socket.destroy();
       });
  }
  </code></pre>
  
  <p><a href="https://github.com/nodejs/node/issues/9845#issuecomment-264032107" rel="nofollow noreferrer">I read</a> that you can fix that by adding ciphers like </p>
  
  <pre><code>ciphers: 'DES-CBC3-SHA'
  </code></pre>
  
  <p>but I do not know how relevant it is to my code and even where to put that!</p>
  
  <p>Here is the detail of the error</p>
  
  <pre><code>{ Error: socket hang up
  at createHangUpError (_http_client.js:253:15)
  at Socket.socketCloseListener (_http_client.js:285:23)
  at emitOne (events.js:101:20)
  at Socket.emit (events.js:188:7)
  at TCP._handle.close [as _onclose] (net.js:497:12) code: 'ECONNRESET' }
  </code></pre>
  
  <p><strong>edit:</strong> updated to latest version (2.0.3) and still having the issue.</p>
  
  <p><strong>edit2:</strong> It appears ECONNERESET happens when using <strong>io.emit</strong> which is weird because it feels like it tries to emit without verifying that the socket is still connected first...</p>