arduino-libraries / ArduinoMqttClient

ArduinoMqttClient Library for Arduino
GNU Lesser General Public License v2.1
187 stars 73 forks source link

Retained messages are not received #46

Open GreatSnoopy opened 4 years ago

GreatSnoopy commented 4 years ago

Hello, Is there a known issue with retained messages not being received? I am using ArduinoMqttClient on a ESP32 type board. I am able to successfully subscribe to 2 topics and i can successfully receive any message that comes on those topic AFTER my application is running. However, retained messages on that topic are never being received.

aentinger commented 4 years ago

Hi, possibly a broker problem? If you connect with a MQTT command line client, can you then receive the retained messages?

GreatSnoopy commented 4 years ago

Not a problem with the broker. Works as expected with mosquitto_sub on a desktop machine in the network as well as with a sketch based on https://github.com/plapointe6/EspMQTTClient on the same ESP32 board.

Webbeh commented 3 years ago

I have a similar issue.

If you subscribe to multiple topics, I only receive one of the retained messages sometimes, and sometimes I don't.

I had to subscribe in cascade (subscribe, read the message received, subscribe to the next, ...) to avoid this issue.

Also when you subscribe, I find that listening to incoming messages with no operation in between greatly improves my luck.