Imroy / pubsubclient

A client library for the ESP8266 that provides support for MQTT
MIT License
434 stars 115 forks source link

added simple publish method with retained flag #34

Open doebi opened 8 years ago

moritzmhmk commented 8 years ago

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

doebi commented 8 years ago

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.

Testato commented 8 years ago

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" notifications@github.com 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.

doebi commented 8 years ago

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. ;)

skorokithakis commented 8 years ago

@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

Testato commented 8 years ago

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.