Closed jinvillaz-zz closed 7 years ago
Were you able to track down the source of the problem? Which version of MongoDB are you using?
I am using mongodb 3.2 and node 6.9.4.
I dont know which is the problem exactly.
I could check that the data are saved in mongo, the data are sent by mosca to client, but the client only receives messages with length 0.
I also tested the same fly code with redis and it is working correctly.
I think payload should be a Buffer
to work properly.
Yes I had the same problem, payload should definitely be a Buffer or else offline packet retrieve from Mongo will not work and will always return a zero length buffer. This is dues to the line here
The proper solution would be for the code to check if the returned payload was a Buffer or simply return the payload otherwise... I could issue a pull request with this change
Please do!
Il giorno ven 21 lug 2017 alle 14:27 Dimitris Halatsis < notifications@github.com> ha scritto:
Yes I had the same problem, payload should definitely be a Buffer or else offline packet retrieve from Mongo will not work and will always return a zero length buffer. This is dues to the line here https://github.com/mcollina/mosca/blob/021517e0112169d6e345234ec5bb66cca394aff9/lib/persistence/mongo.js#L354
The proper solution would be for the code to check if the returned payload was a Buffer or simply return the payload otherwise... I could issue a pull request with this change
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/mcollina/mosca/issues/616#issuecomment-316988020, or mute the thread https://github.com/notifications/unsubscribe-auth/AADL41kE7TXvfwJInMuaGPnAb8agvKxwks5sQJlBgaJpZM4MV3SY .
Hello, Retrieve messages in mongo after reconnecting. I have problem to retrieve messages after to reconnect with broker Mosca. The messages are saved for send to client after to reconnect, but the client receive only a buffer with length 0. With redis I dont have any problems.
broker code:
client code: