Node.JS + socket.io + IIS = ECONNRESET

I am running an SSL socket on port 8081. Although this works fine with Apache2.4, after a while in IIS, socket.io crashes with ECONNRESET, which never happens with Apache. My version of socket.io is 1.3.7. IIS - v10 (Windows 2016 server).

I added some bug fixes as recommended, but this does not solve the problem. Here is the sanitized 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();
     });
}

I read that you can fix this by adding ciphers like

ciphers: 'DES-CBC3-SHA'

but I don’t know how appropriate this is for my code and even where it is needed!

Here is the error detail

{ 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' }

edit: updated to the latest version (2.0.3) and still has a problem.

edit2: , ECONNERESET io.emit, , , , , ...

+4
2

, IIS WebSockets node.js, , - socket.io WebSocket Apps IIS iisnode.

IIS web.config, , WebSocket IIS node.js. WebSocket.

WebSocket, IIS 8, IIS 10 .

IIS WebSocket, Janczuks, web.config IIS.

<WebSocket enabled="false"/>
+3

var options = {
  key: fs.readFileSync('example.key'),
  cert: fs.readFileSync('example.cert'),
  ca: fs.readFileSync('example.inter'),
  ciphers: 'DES-CBC3-SHA'
};

+2

Source: https://habr.com/ru/post/1692066/


All Articles