-
Notifications
You must be signed in to change notification settings - Fork 107
automatically sending messages
If a client has the previous connection that set clean_session to false and the client has inflight messages, then the inflight messages are automaticall sent after connack
message is received.
NOTE: inflight message means publish
message or pubrel
message that aren't received the corresponding response messages.
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.
If you call set_keep_alive_sec()
or set_keep_alive_sec_ping_ms()
member functions, then start sending pingreq
automatically.
- Requirements
- Config
- Tutorial
- Authentication and Authorization
- Advanced topics
- Examples
- API Reference
- Versioning Policy
- How to contribute