Extend mg_mqtt_{pub,sub} by adding qos and retain

This commit is contained in:
cpq committed 2021-06-10 19:27:19 +01:00
1 parent a15d518571
commit 3deafaea7f
8 files changed
+39 -63

No files matched your search

+4 -14
View File
@@ -977,28 +977,18 @@ Create client MQTT connection.
```c
void mg_mqtt_pub(struct mg_connection *, struct mg_str *topic,
struct mg_str *data);
struct mg_str *data, int qos, bool retain);
```
Publish message `data` to the topic `topic`.
### mg\_mqtt\_pubex()
```c
void mg_mqtt_pubex(struct mg_connection *, struct mg_str *topic,
struct mg_str *data, int qos, bool retain);
```
Like `mg_mqtt_pub()` but also allows to set QoS and retain flag.
Publish message `data` to the topic `topic` with given QoS and retain flag.
### mg\_mqtt\_sub()
```c
void mg_mqtt_sub(struct mg_connection *, struct mg_str *topic);
void mg_mqtt_sub(struct mg_connection *, struct mg_str *topic, int qos);
```
Subscribe to topic `topic`.
Subscribe to topic `topic` with given QoS.
### mg\_mqtt\_next\_sub()