freshworkstudio / gps-tracking-nodejs

Let you work with some GPS trackers that connects through tcp.
MIT License
260 stars 159 forks source link

Error: read ECONNRESET #12

Open DynWebService opened 6 years ago

DynWebService commented 6 years ago

Hello,

I recently implemented an adapter for a device, but eventually the node stops the error below: ` events.js:160 throw er; // Unhandled 'error' event ^

Error: read ECONNRESET at exports._errnoException (util.js:1020:11) at TCP.onread (net.js:568:26) `

Can you help me?

vcianaya commented 6 years ago

Hello, I have the same problem, did you solve it ???

maykonmultilig commented 6 years ago

Hello,

Yes, i just add the follow lines in my server.js:

    connection.on('error', function (data) {
       //error handling here 
    })

in my case i just ignore this.

connection.on('error', function (data) {
        console.log("Connection Error: ");
        console.log(data);
       // device.error(data, 'Connection error');
    });

my server.js

var server = gps.server(options,function(device, connection){

    device.on("login_request",function(device_id, msg_parts){
        if (device_id < 0) {
            this.login_authorized(false);
        } else {
            this.login_authorized(true);
        }

    });

    //PING -> When the gps sends their position  
    device.on("ping",function(data){
        return data;
    });

    connection.on('error', function (data) {
        console.log("Connection Error: ");
        console.log(data);
       // device.error(data, 'Connection error');
    });

});
gdespirito commented 6 years ago

Do you have some code example so I can test the problem?

vcianaya commented 6 years ago

image

That error comes out

GokulanJayaram commented 6 years ago

What is the best way to resolve this than just ignoring?