mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-16 20:41:20 +08:00
Merge pull request #1618 from cesanta/mqtt
updated docs and example to recently exported MQTT result codes
This commit is contained in:
commit
c4e496b001
@ -1911,7 +1911,7 @@ Usage example:
|
||||
```c
|
||||
// Iterate over all MQTT frames contained in buf, len
|
||||
struct mg_mqtt_message mm;
|
||||
while ((mg_mqtt_parse(buf, len, &mm)) == 0) {
|
||||
while ((mg_mqtt_parse(buf, len, &mm)) == MQTT_OK) {
|
||||
switch (mm.cmd) {
|
||||
case MQTT_CMD_CONNACK:
|
||||
...
|
||||
|
@ -40,7 +40,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
uint8_t version = c->is_mqtt5 ? 5 : 4;
|
||||
MG_INFO(("GOT %d bytes WS msg", (int) wm->data.len));
|
||||
while ((mg_mqtt_parse((uint8_t *) wm->data.ptr, wm->data.len, version,
|
||||
&mm)) == 0) {
|
||||
&mm)) == MQTT_OK) {
|
||||
switch (mm.cmd) {
|
||||
case MQTT_CMD_CONNACK:
|
||||
mg_call(c, MG_EV_MQTT_OPEN, &mm.ack);
|
||||
|
Loading…
x
Reference in New Issue
Block a user