MQTT connection options. More...
#include <mqtt.h>
Data Fields | |
| const char * | client_id |
| MQTT client identifier sent in CONNECT. More... | |
| const char * | username |
| Optional username sent in CONNECT. More... | |
| const char * | password |
| Optional password sent in CONNECT. More... | |
| uint16_t | keepalive_s |
Keep-alive interval, in seconds, sent in CONNECT - 0 defaults to 60. More... | |
MQTT connection options.
Optional settings beyond the address/port/timeout passed directly to net_mqtt_init(). When NULL is passed there, implementation defaults are used for every field here. QoS is deliberately not one of them - it's a per-message property of the MQTT protocol itself (each PUBLISH/ SUBSCRIBE carries its own), not a connection-level setting, so it'll be a parameter on those calls rather than living here. Session state (clean session vs. resumed) isn't exposed either - the implementation always connects with a clean session.
| const char* net_mqtt_config_t::client_id |
| uint16_t net_mqtt_config_t::keepalive_s |
Keep-alive interval, in seconds, sent in CONNECT - 0 defaults to 60.
A compliant broker drops the connection after roughly 1.5x this interval with no traffic from this client; net_poll() sends an automatic PINGREQ once this much time has passed since the last one (or since connecting), so this rarely needs setting explicitly - lower it only for a broker/network that needs faster liveness detection, or for testing.
| const char* net_mqtt_config_t::password |
| const char* net_mqtt_config_t::username |