espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
603 stars 255 forks source link

Last Will Message pushed when I reconnect (IDFGH-10970) #266

Closed garudaonekh closed 1 year ago

garudaonekh commented 1 year ago

Hi, Last Will message is not seen when it's disconnected. But it's seen when the ESP32 reconnect again.

I use framework-espidf @ 3.40405.230623 (4.4.5) because I also need to use Arduino As Component and this is the latest version of ESPIDF it can support right now.

Here's my config:

esp_mqtt_client_config_t mqtt_cfg = {

        .event_handle = mqtt_event_handler,
        .uri = broker_vpn,
        // .user_context = (void *)your_context,
        .username = strlen(mqtt_user)==0 ? NULL : mqtt_user,
        .password = strlen(mqtt_password)==0 ? NULL : mqtt_password,
        .lwt_topic="IAmDead",
        .lwt_msg="bye",
        .lwt_qos=0,
        .lwt_retain=0,
        .lwt_msg_len=3,
        .disable_clean_session=1
    };
garudaonekh commented 1 year ago

Sorry, it's problem with my MQTT Broker