Skip to content

automatically sending messages

Takatoshi Kondo edited this page Jun 3, 2019 · 5 revisions

MQTT publish sequence

MQTT protocol defines the following publish sequence:

  • QoS0
sender direction receiver
publish ->
  • QoS1
sender direction receiver
publish ->
<- puback
  • QoS2
sender direction receiver
publish ->
<- pubrec
pubrel ->
<- pubcomp

auto_pub_response is for QoS1 and QoS2. puback on QoS1, pubrec, pubrel, and pubcomp on QoS2 are auto_pub_response target messages. If auto_pub_response is enabled, then those messages are automatically sent.

auto_pub_response is enabled by default. You can enable/disable auto_pub_response using set_auto_pub_response() function.

If you implement typical MQTT client application, auto_pub_response helps avoiding bothersome implementation. If you implement MQTT broker, you might want to check publish permission. In this case, disabling auto_pub_response helps detailed implementation. You can send response messages such as puback manually.

Clone this wiki locally