moscajs / mosca

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

MQTT broker should send last retained value on subscribing #513

Closed aborovsky closed 8 years ago

aborovsky commented 8 years ago

Proper MQTT broker (mosquitto, for example) sends last retained value when client subscribing to topic.

If one try to publish some value to topic with retain=true to Mosca (v2.0.1). And then subscribe to the same topic, no retained value will be send just after subscribe.

Running mosca with:

node ./bin/mosca -v --http-port 8383 -d mqtt
mcollina commented 8 years ago

If you meant "proper", then it's probably not worth replying to this question. I am a huge fan of mosquitto, so please use that instead. Anyway, it's working here, so probably is it something on your side. As an example, QoS 2 is not supported.

aborovsky commented 8 years ago

Hello, @mcollina. Sorry, I don't mean to hurt your feelings about "properness" of Mosca :) For my purposes Mosca even better then Mosquitto, really!

So, Mosca, absolutely and for sure should send last retained value to subscribing client? What type of misconfiguration may break this function?

mcollina commented 8 years ago

Not sure, it should work straight out of the box.

npm i  mosca -g
mosca

On other shell:

mqtt pub -r hello world
mqtt sub -t hello -v
aborovsky commented 8 years ago

Thx, will try as you recommend. If trouble will be reproduced even out-of-the box, I'd like to debug the sources.

Please, point me to the file (and line number), where last retained value being send to the client, just after subscribe.

Appreciate your help. Чт, 30 июня 2016 г. в 20:55, Matteo Collina notifications@github.com:

Not sure, it should work straight out of the box.

npm i mosca -g mosca

On other shell:

mqtt pub -r hello world mqtt sub -t hello -v

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mcollina/mosca/issues/513#issuecomment-229737322, or mute the thread https://github.com/notifications/unsubscribe/ABl5LKNB6KucHKU--w9zU7ERDu38VUuaks5qRAKggaJpZM4JCZST .

[image: BeeToo] http://beetoo.me/ Когда умный дом по-настоящему умный Александр Боровский, Технический директор Alexander Borovsky, CTO, Co-Founder +7-926-0-945-00 <+7926094500> +7-499-391-33-62 <+74993913362>aborovsky@beetoo.me http://beetoo.me

mcollina commented 8 years ago

https://github.com/mcollina/mosca/blob/master/lib/persistence/abstract.js#L86-L96

aborovsky commented 8 years ago

Oh yeah!

It work's just like it should everywhere. In version, released into npmjs.com and in version 2.0.1 here, in git repo.

Thank your for help!