2.1 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	API Reference
Header files
File mosq_broker.h
Structures and Types
| Type | Name | 
|---|---|
| struct | mosq_broker_config  Mosquitto configuration structure.  | 
| typedef void(* | mosq_message_cb_t   | 
Functions
| Type | Name | 
|---|---|
| int | mosq_broker_run (struct mosq_broker_config *config)  Start mosquitto broker.  | 
| void | mosq_broker_stop (void)  Stops running broker.  | 
Structures and Types Documentation
struct mosq_broker_config
Mosquitto configuration structure.
ESP port of mosquittto supports only the options in this configuration structure.
Variables:
- 
void(* handle_message_cb
On message callback. If configured, user function is called whenever mosquitto processes a message. - 
char * host
Address on which the broker is listening for connections - 
int port
Port number of the broker to listen to - 
esp_tls_cfg_server_t * tls_cfg
ESP-TLS configuration (if TLS transport used) Please refer to the ESP-TLS official documentation for more details on configuring the TLS options. You can open the respective docs with this idf.py command:idf.py docs -sp api-reference/protocols/esp_tls.html 
typedef mosq_message_cb_t
typedef void(* mosq_message_cb_t) (char *client, char *topic, char *data, int len, int qos, int retain);
Functions Documentation
function mosq_broker_run
Start mosquitto broker.
int mosq_broker_run (
    struct mosq_broker_config *config
)
This API runs the broker in the calling thread and blocks until the mosquitto exits.
Parameters:
configMosquitto configuration structure
Returns:
int Exit code (0 on success)
function mosq_broker_stop
Stops running broker.
void mosq_broker_stop (
    void
)
Note:
After calling this API, function mosq_broker_run() unblocks and returns.