Nodejs MQTT implementation issue – flespi forum

Hi!

I’m having trouble with mqtt implementation in nodejs. I’m connecting with the example nodejs script, with a clean:false setting:

const mqtt = require('mqtt');

const client = mqtt.connect('mqtts://mqtt.flespi.io:8883', {
  clientId: 'flespi-examples-mqtt-client-nodejs',
  // see https://flespi.com/kb/tokens-access-keys-to-flespi-platform to read about flespi tokens
  username: `FlespiToken ${process.env.FlespiToken}`,
  protocolVersion: 5,
  clean: false
});

But when I check the settings of the session, it clearly says, it’s a clean session:

{
  "result": [
    {
      "size": 0,
      "ip": "37.76.123.229",
      "id": 2761155786,
      "connected": true,
      "cid": 2042338,
      "clean": true,
      "client_id": "flespi-examples-mqtt-client-nodejs",
      "expires": 0
    }
  ]
}

I don’t really see what could be the problem here…

Read more here: Source link