MQTT Disconnect Reason Code

Hello, 

I would like to send a reason code when disconnecting the client (nRF9160DK) and server in MQTT. How can I do this?

It seems that there is no argument to specify a reason code in the AT#XMQTTCON command or the mqtt_disconnect() function.

In particular, I would like to send 0x04 (Disconnect with Will Message).

Our environment is as follows.

HW: nRF9160DK (PCA10090 1.1.0)

NCS Ver: 2.7.0

Sample Project: serial_lte_modem

Best regards, 

Gotoda

Parents
  • My understanding is that WILL message is NOT triggered by intentional MQTT disconnecting. Instead, broker will send the will of the client (obtained when connecting broker) in the case of below (MQTT 3.1.1).

    Zephyr MQTT API does not have reason code, because it's based on MQTT 3.1.1, and the feature is not available until MQTT 5.0.0.

Reply
  • My understanding is that WILL message is NOT triggered by intentional MQTT disconnecting. Instead, broker will send the will of the client (obtained when connecting broker) in the case of below (MQTT 3.1.1).

    Zephyr MQTT API does not have reason code, because it's based on MQTT 3.1.1, and the feature is not available until MQTT 5.0.0.

Children
No Data
Related