mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-08 05:15:16 +08:00
23122b327c
It would be probably good idea to also remove tools/docgen.py and asciidoc.mk, but asciidoc.mk is still mentioned under `cloud/doc`, which may contain some useful info which we'll need at least to review before removing. PUBLISHED_FROM=faf454d4c52a2f07ea8ac084cf0bd11a0c9c9b3b
895 B
895 B
title | decl_name | symbol_kind | signature |
---|---|---|---|
mg_mqtt_broker() | mg_mqtt_broker | func | void mg_mqtt_broker(struct mg_connection *brk, int ev, void *data); |
Process a MQTT broker message.
Listening connection expects a pointer to an initialized mg_mqtt_broker
structure in the user_data
field.
Basic usage:
mg_mqtt_broker_init(&brk, NULL);
if ((nc = mg_bind(&mgr, address, mg_mqtt_broker)) == NULL) {
// fail;
}
nc->user_data = &brk;
New incoming connections will receive a mg_mqtt_session
structure
in the connection user_data
. The original user_data
will be stored
in the user_data
field of the session structure. This allows the user
handler to store user data before mg_mqtt_broker
creates the session.
Since only the MG_EV_ACCEPT message is processed by the listening socket,
for most events the user_data
will thus point to a mg_mqtt_session
.