pubsubclient icon indicating copy to clipboard operation
pubsubclient copied to clipboard

added simple publish method with retained flag

Open doebi opened this issue 10 years ago • 6 comments

doebi avatar Sep 02 '15 22:09 doebi

This is exactly what I was missing - why is this not merged?

moritzmhmk avatar Sep 16 '15 19:09 moritzmhmk

i have no idea... looks like Imroy is kind of inactive atm. but you can use my branch for now, as long as there is no newer commit or this gets finally merged.

doebi avatar Sep 16 '15 21:09 doebi

Sorry for the question, The retained flag will never expire ? The message whit retain flag will send always to all subscribers ? At every subcription also if the subscriber already received it some time ago ?

Thanks Il 16/set/2015 23:13, "Christoph Döberl" [email protected] ha scritto:

i have no idea... looks like Imroy is kind of inactive atm. but you can use you my branch for now as long there is no newer commit or this gets finally merged.

— Reply to this email directly or view it on GitHub https://github.com/Imroy/pubsubclient/pull/34#issuecomment-140896709.

Testato avatar Sep 17 '15 06:09 Testato

This is actually a question about the protocol itself and not this client implementation. The man-page of mqtt, which can be found at http://mosquitto.org/man/mqtt-7.html defines retained messages as follows:

All messages may be set to be retained. This means that the broker will keep the message even after sending it to all current subscribers. If a new subscription is made that matches the topic of the retained message, then the message will be sent to the client. This is useful as a "last known good" mechanism. If a topic is only updated infrequently, then without a retained message, a newly subscribed client may have to wait a long time to receive an update. With a retained message, the client will receive an instant update.

Hope this helps. ;)

doebi avatar Sep 17 '15 09:09 doebi

@doebi, do you think you could add a simple library.json so this can get added to PlatformIO? It would greatly simplify dependency management for me.

http://docs.platformio.org/en/latest/librarymanager/creating.html#at-github

skorokithakis avatar Dec 11 '15 01:12 skorokithakis

Retain is already present in the new publish mqtt class, imroy maybe want to use MQTT:: instead of the original publish method of this lib ?

In the homepage of this github repo he write:

New features

A whole set of MQTT classes has been added, one for each message type. This moved a good amount of code out of the PubSubClient class, leaving it to handle the high-level flow of the protocol. The MQTT classes handle getting data into and out of the messages.

Testato avatar Dec 11 '15 08:12 Testato