picofuse

Data Fields
net_mqtt_config_t Struct Reference

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...
 

Detailed Description

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.

Definition at line 120 of file mqtt.h.

Field Documentation

◆ client_id

const char* net_mqtt_config_t::client_id

MQTT client identifier sent in CONNECT.

NULL or empty auto-generates one.

Definition at line 121 of file mqtt.h.

◆ keepalive_s

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.

Definition at line 127 of file mqtt.h.

◆ password

const char* net_mqtt_config_t::password

Optional password sent in CONNECT.

Only ever sent alongside a non-empty username.

Definition at line 125 of file mqtt.h.

◆ username

const char* net_mqtt_config_t::username

Optional username sent in CONNECT.

NULL or empty sends none.

Definition at line 123 of file mqtt.h.


The documentation for this struct was generated from the following file: