Page 1 of 1

Send message to broker MQTT

Posted: Sun Nov 18, 2018 6:17 pm
by onire77
Hi,
I want to change this example https://github.com/espressif/esp-mqtt/b ... pp_main.c to send every 10 seconds a temperature to a broker. I don’t understand how to modify the mqtt_event_handler for my necessity.

Re: Send message to broker MQTT

Posted: Mon Nov 19, 2018 7:42 pm
by Ritesh
onire77 wrote:
Sun Nov 18, 2018 6:17 pm
Hi,
I want to change this example https://github.com/espressif/esp-mqtt/b ... pp_main.c to send every 10 seconds a temperature to a broker. I don’t understand how to modify the mqtt_event_handler for my necessity.
This example is just to start MQTT client which will do some configuration and will start MQTT.

So, You need to create pusblisher and subscriber as per your requirement and then create example to fulfill your end application

MQTT event handler is just to provide few MQTT related events which also you can used based on event you will get from MQTT

Re: Send message to broker MQTT

Posted: Tue Dec 18, 2018 4:01 pm
by Auguste
Hello,

I understand that I have to create my own event handler but I don't know how to do it. In the tcp exemple we have the user_context but I don't know how to use it. Could you explain me how it works ?

Thanks