moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 508 forks source link

What is this error ? "name":"mosca","level":40,"time":1484656613809,"msg":"read ECONNRESET" #594

Closed BrotherPeng closed 7 years ago

BrotherPeng commented 7 years ago

{"pid":8744,"hostname":"DESKTOP-TQ57PBL","name":"mosca","level":40,"time":1484656613809,"msg":"read ECONNRESET","type":"Error","stack":"Error: read ECONNRESET\n at exports._errnoException (util.js:1026:11)\n at TCP.onread (net.js:572:26)","code":"ECONNRESET","errno":"ECONNRESET","syscall":"read","client":"mqttjs_2d664630","v":1} {"pid":8744,"hostname":"DESKTOP-TQ57PBL","name":"mosca","level":40,"time":1484656613820,"msg":"read ECONNRESET","type":"Error","stack":"Error: read ECONNRESET\n at exports._errnoException (util.js:1026:11)\n at TCP.onread (net.js:572:26)","code":"ECONNRESET","errno":"ECONNRESET","syscall":"read","client":"mqttjs_13f89ed0","v":1} {"pid":8744,"hostname":"DESKTOP-TQ57PBL","name":"mosca","level":40,"time":1484656613820,"msg":"read ECONNRESET","type":"Error","stack":"Error: read ECONNRESET\n at exports._errnoException (util.js:1026:11)\n at TCP.onread (net.js:572:26)","code":"ECONNRESET","errno":"ECONNRESET","syscall":"read","client":"mqttjs_e71c8430","v":1}

      ` for (let i = 0; i < nodes.length; i++) {

            let x = nodes[i];

            let cid = 'mqttjs_' + Math.random().toString(16).substr(2, 8);

            let mqtt_client = mqtt.connect(url, {

                username: x.machine_id,

                password: x.secret,

                clientId: cid

            });

            $this.nodes_client.set(x.machine_id, mqtt_client);

        }

         for (let [mid, client] of $this.nodes_client) {

            sails.log.info('b.machine_id~~~~~~~~~~~~~~~~~~~~~~~~~~' + client.id);

            sails.log.info(mid);

            client.on('connect', function () {

                client.subscribe('node/' + mid + '/params/changed'); 

                sails.log.info('connect.............................');

            });
            client.on('reconnect', function () {

                sails.log.info('reconnect................')

            })

            client.on('close', function () {

                sails.log.info('close..........')
            })

            client.on('offline', function () {

                sails.log.info('offline...................')

            })

            client.on('error', function () {

                sails.log.info('error')

            })

            client.on('message', function (topic, message) {

                }
        }`
mcollina commented 7 years ago

A client disconnected abruptly. It is not an error on your code, but it might signal a malfunction on the other side.