knolleary / pubsubclient

A client library for the Arduino Ethernet Shield that provides support for MQTT.
http://pubsubclient.knolleary.net/
MIT License
3.78k stars 1.46k forks source link

Retain Flag not working #1035

Open nataizya opened 7 months ago

nataizya commented 7 months ago

Hi,

I am new to programming ESPs and using the PubSubClient so bear with me.

I am trying to publish retained messages to AWS IoT Core with the following line of code:

client.publish(AWS_IOT_STATUS_TOPIC, jsonBuffer, true);

Everything runs fine with no errors but the message is not published to my topic. When I remove the retained flag and have the code as below, the message is published successfully and I can see it in my topic.

client.publish(AWS_IOT_STATUS_TOPIC, jsonBuffer);

I am using the PubSubClient version 2.8 on an ESP8266EX.

Is there anything I could be missing?

HotNoob commented 4 months ago

having the same problem.