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

Zeni241
Posts: 33
Joined: Tue Nov 20, 2018 4:28 am

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

Postby Zeni241 » Fri Mar 15, 2019 12:20 pm

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

Zeni241
Posts: 33
Joined: Tue Nov 20, 2018 4:28 am

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

Postby Zeni241 » Fri Mar 15, 2019 2:53 pm

I was missing setting retained flag!
Now following deleted retained message on broker:
esp_mqtt_client_publish(mqttclient, "mytopic"," ",0, 0, 1)

Who is online

Users browsing this forum: Google [Bot] and 16 guests