moscajs / mosca

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

client.subscribe('$SYS/+/new/clients', { qos: 1 }); #544

Closed renrenfree closed 7 years ago

renrenfree commented 7 years ago
  1. client.subscribe('$SYS/+/new/clients', { qos: 1 }); // clean:false
  2. client exit
  3. client start
  4. client receive Packet { cmd: 'publish', retain: false, qos: 0, dup: false, length: 27, topic: '$SYS/rkgyY2Ja/new/clients', payload: }

why the payload is empty?

mcollina commented 7 years ago

The payload should be the client id: https://github.com/mcollina/mosca/blob/master/lib/server.js#L240-L244.

Feel free to open up a PR to fix an issue, if it's there.

renrenfree commented 7 years ago

I think this is helpful~

{"pid":9548,"hostname":"MacBook-Pro.local","name":"mqtt","level":20,"time":1474512820344,"msg":"Forwarding offline packet","packet":{"messageId":"ryo3Dae6","topic":"$SYS/rk8Wwaep/new/clients"},"client":"123-c1","v":1} Published { topic: '$SYS/rk8Wwaep/new/clients', payload: '123-c1', messageId: 'By23Daea', qos: undefined, retain: undefined }

if (data.added.getTime() + that.options.ttl.packets > now) { data.packet.payload = data.packet.payload.buffer; cb(null, data.packet); }

mcollina commented 7 years ago

I'm still lost. Can you send some code using MQTT.js or mqtt-packet that demonstrate the issue?

TangMonk commented 7 years ago

Wow, Pony? It is you? @renrenfree

mcollina commented 7 years ago

Closing for no activity. Feel free to reopen.