mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-28 12:30:58 +00:00
Restore mg_mqtt_{ping,pong,disconnect}
This commit is contained in:
1 parent
366426e8bb
commit
060bb29cdc
4 files changed
+30
No files matched your search
+12
@@ -2019,6 +2019,18 @@ static void mqtt_cb(struct mg_connection *c, int ev, void *ev_data,
|
|||||||
(void) fn_data;
|
(void) fn_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mg_mqtt_ping(struct mg_connection *nc) {
|
||||||
|
mg_mqtt_send_header(nc, MQTT_CMD_PINGREQ, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mg_mqtt_pong(struct mg_connection *nc) {
|
||||||
|
mg_mqtt_send_header(nc, MQTT_CMD_PINGRESP, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mg_mqtt_disconnect(struct mg_connection *nc) {
|
||||||
|
mg_mqtt_send_header(nc, MQTT_CMD_DISCONNECT, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
struct mg_connection *mg_mqtt_connect(struct mg_mgr *mgr, const char *url,
|
struct mg_connection *mg_mqtt_connect(struct mg_mgr *mgr, const char *url,
|
||||||
struct mg_mqtt_opts *opts,
|
struct mg_mqtt_opts *opts,
|
||||||
mg_event_handler_t fn, void *fn_data) {
|
mg_event_handler_t fn, void *fn_data) {
|
||||||
|
|||||||
@@ -829,6 +829,9 @@ void mg_mqtt_send_header(struct mg_connection *, uint8_t cmd, uint8_t flags,
|
|||||||
uint32_t len);
|
uint32_t len);
|
||||||
int mg_mqtt_next_sub(struct mg_mqtt_message *msg, struct mg_str *topic,
|
int mg_mqtt_next_sub(struct mg_mqtt_message *msg, struct mg_str *topic,
|
||||||
uint8_t *qos, int pos);
|
uint8_t *qos, int pos);
|
||||||
|
void mg_mqtt_ping(struct mg_connection *);
|
||||||
|
void mg_mqtt_pong(struct mg_connection *);
|
||||||
|
void mg_mqtt_disconnect(struct mg_connection *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+12
@@ -232,6 +232,18 @@ static void mqtt_cb(struct mg_connection *c, int ev, void *ev_data,
|
|||||||
(void) fn_data;
|
(void) fn_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mg_mqtt_ping(struct mg_connection *nc) {
|
||||||
|
mg_mqtt_send_header(nc, MQTT_CMD_PINGREQ, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mg_mqtt_pong(struct mg_connection *nc) {
|
||||||
|
mg_mqtt_send_header(nc, MQTT_CMD_PINGRESP, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mg_mqtt_disconnect(struct mg_connection *nc) {
|
||||||
|
mg_mqtt_send_header(nc, MQTT_CMD_DISCONNECT, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
struct mg_connection *mg_mqtt_connect(struct mg_mgr *mgr, const char *url,
|
struct mg_connection *mg_mqtt_connect(struct mg_mgr *mgr, const char *url,
|
||||||
struct mg_mqtt_opts *opts,
|
struct mg_mqtt_opts *opts,
|
||||||
mg_event_handler_t fn, void *fn_data) {
|
mg_event_handler_t fn, void *fn_data) {
|
||||||
|
|||||||
@@ -55,3 +55,6 @@ void mg_mqtt_send_header(struct mg_connection *, uint8_t cmd, uint8_t flags,
|
|||||||
uint32_t len);
|
uint32_t len);
|
||||||
int mg_mqtt_next_sub(struct mg_mqtt_message *msg, struct mg_str *topic,
|
int mg_mqtt_next_sub(struct mg_mqtt_message *msg, struct mg_str *topic,
|
||||||
uint8_t *qos, int pos);
|
uint8_t *qos, int pos);
|
||||||
|
void mg_mqtt_ping(struct mg_connection *);
|
||||||
|
void mg_mqtt_pong(struct mg_connection *);
|
||||||
|
void mg_mqtt_disconnect(struct mg_connection *);
|
||||||
Reference in new issue
Block a user