• What's the IP of the Espruino that's connecting?

    192.168.0.18

    And do you know what mqttjs_18553fd6 is?

    I created an Electron App using the mqttjs module. My Electron app just sends a mqtt message every 30 seconds with updates about the status of my computer.

    Electron App code:

    
          const shutdown = require('electron-shutdown-command');
          var lockYourWindows = require('lock-your-windows');
          var mqtt = require('mqtt');
          var client  = mqtt.connect('mqtt://192.168.0.17', [{protocolId: 'MQTT'}]);
          client.on('connect', function () {
            client.subscribe('#');
          })
    
          client.on('message', function (topic, message) {
            // message is Buffer
            var msg = message.toString();
            //console.log(topic.toString());
    
            if(msg == "lockscreen") {
              var isLocked = lockYourWindows.isLocked();
              lockYourWindows.lock();
            }
    
            if(msg == "shutdown") {
              //shutdown.logoff();
            }
    
            if(msg == "logoff") {
              shutdown.logoff();
            }
          });
    
          function isScreenLocked() {
            var isLocked = lockYourWindows.isLocked();
            var v = isLocked ? 1 : 0;
            client.publish('/mydevice/lockscreen/sta­tus', v.toString());
          }
    
          // Ever 30 seconds send a MQTT msg to nodered to update the Lockscreen Status Guage
          setInterval(isScreenLocked, 30000);
    
    

    Espruino IDE console:

    MQTT=> /mydevice/lockscreen/status 0
    MQTT=> /mydevice/lockscreen/status 0
    MQTT=> /mydevice/lockscreen/status 0
    MQTT disconnected... reconnecting.

    Here is a new log:

    1533770037: New connection from 192.168.0.18 on port 1883. 1533770037:
    New client connected from 192.168.0.18 as 4de309a8004f (c1, k60).
    1533770095: Client a7c51f6bdcc7 has exceeded timeout, disconnecting.
    1533770095: Socket error on client a7c51f6bdcc7, disconnecting.
    1533770363: New connection from 192.168.0.9 on port 1883. 1533770363:
    New client connected from 192.168.0.9 as mqttjs_6ce48170 (c1, k60).
    1533770480: Client 4de309a8004f has exceeded timeout, disconnecting.

About

Avatar for d0773d @d0773d started