MQTT5 last will message
Posted: Fri Apr 28, 2023 10:40 am
Hello. I use mqtt5 example from esp-idf.
Settings are set to the default values:
I am not fully understanding which settings control when the last will message will be sent?
The settings that I am concerned about:
.session_expiry_interval = 10,
What does session expiry mean? How does it affect last will?
.will_delay_interval = 10,
Does that mean that will message will be sent 10 seconds after disconnecting?
The reason I ask this is because on my mqtt broker, I receive last will message 3 minutes after device is disconnected. Why 3 minutes? How to change that time?
Settings are set to the default values:
Code: Select all
.session_expiry_interval = 10,
.maximum_packet_size = 1024,
.receive_maximum = 65535,
.topic_alias_maximum = 2,
.request_resp_info = true,
.request_problem_info = true,
.will_delay_interval = 10,
.payload_format_indicator = true,
.message_expiry_interval = 10,
.response_topic = "/test/response",
.correlation_data = "123456",
.correlation_data_len = 6,
};
esp_mqtt_client_config_t mqtt5_cfg = {
.broker.address.uri = CONFIG_BROKER_URL,
.session.protocol_ver = MQTT_PROTOCOL_V_5,
.network.disable_auto_reconnect = true,
.credentials.username = "123",
.credentials.authentication.password = "456",
.session.last_will.topic = "/topic/will",
.session.last_will.msg = "i will leave",
.session.last_will.msg_len = 12,
.session.last_will.qos = 1,
.session.last_will.retain = false,
};
The settings that I am concerned about:
.session_expiry_interval = 10,
What does session expiry mean? How does it affect last will?
.will_delay_interval = 10,
Does that mean that will message will be sent 10 seconds after disconnecting?
The reason I ask this is because on my mqtt broker, I receive last will message 3 minutes after device is disconnected. Why 3 minutes? How to change that time?