Page 1 of 1

How can I send empty mqtt message to broker to delete some retained message?

Posted: Fri Mar 15, 2019 12:20 pm
by Zeni241
How can I send empty mqtt message to broker to delete some retained message?
I tried following but it is not working:

Code: Select all

esp_mqtt_client_publish(mqttclient, "mytopic"," ",0, 0, 0);
esp_mqtt_client_publish(mqttclient, "mytopic",' ',0, 0, 0);
esp_mqtt_client_publish(mqttclient, "mytopic",NULL,0, 0, 0);

Re: How can I send empty mqtt message to broker to delete some retained message?

Posted: Fri Mar 15, 2019 2:53 pm
by Zeni241
I was missing setting retained flag!
Now following deleted retained message on broker:
esp_mqtt_client_publish(mqttclient, "mytopic"," ",0, 0, 1)