moscajs / mosca

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

Retain message delivered with empty payload upon client subscribtion #558

Closed liorshalev01 closed 7 years ago

liorshalev01 commented 7 years ago

Using Mongo persistence, retained messages delivered with empty payload.

It looks like the problem in with the line data.payload = data.payload.buffer (lib/persistence/mongo.js#282), data.payload.buffer is undefined. Might be a problem Mongo driver version mismatch?

Regards, Lior

mcollina commented 7 years ago

Probably, what's the problem? can you send me some example? Or a PR?

liorshalev01 commented 7 years ago

Hi Matteo, We farther investigated the problem, and it's origin was when we used Mosca to publish a message. We had to first convert string payload into a buffer before handing them over to Mosca internal publish.

Thanks, Lior