moscajs / mosca

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

MessageId in mosca is different from the messageId in mqtt.js client #542

Closed sn0opr closed 7 years ago

sn0opr commented 7 years ago

I would like to thank you for this huge work. When I publish a message from mqtt.js client, and console.log the sent packet, I get a messageId as a number example: 54110 (which it's generated randomly, if I understood the code), but in the server I see it in this format: BJLC51Dn.

mcollina commented 7 years ago

It is overridden here https://github.com/mcollina/mosca/blob/master/lib/server.js#L351 to have a unique id.

sn0opr commented 7 years ago

@mcollina what is the reason to override it ? If I disable this override and get the default messageId from the received packet, will it cause any conflict or something ?

mcollina commented 7 years ago

@sn0opr exactly. https://github.com/mcollina/aedes uses a different design that does not suffer from this issue.