Tag Archives: Error: read ECONNRESET

Websocket: How to Fix Error Read Econnreset

error message

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:870:11)
    at TCP.onread (net.js:544:26)

terms of settlement

Add event monitoring of error and close

var ws = require("nodejs-websocket");  
var fs = require("fs");  
var zmqutil = require('./zmqutil')

var server = ws.createServer(function (conn) {  
    console.log("connection sussess");  
    var push = zmqutil.socket('push')
    push.connect('tcp://127.0.0.1:7113')

    conn.on("close", function (code, reason) {
        console.log("close connection")
    });
    conn.on("error", function (code, reason) {
        console.log("close error")
    });

    ......
}