mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-01 13:10:43 +00:00
Fix #1434 - set will QoS in CONNECT message correctly, and rename qos -> will_qos in struct mg_mqtt_opts
This commit is contained in:
1 parent
f29807aad8
commit
26a97ec36c
8 files changed
+9
-8
No files matched your search
@@ -80,7 +80,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
|
||||
int main(void) {
|
||||
struct mg_mgr mgr;
|
||||
struct mg_mqtt_opts opts = {.qos = s_qos};
|
||||
struct mg_mqtt_opts opts = {.clean = true};
|
||||
bool done = false;
|
||||
mg_mgr_init(&mgr); // Initialise event manager
|
||||
LOG(LL_INFO, ("Connecting to %s", s_url)); // Inform that we're starting
|
||||
|
||||
@@ -65,7 +65,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
// Timer function - recreate client connection if it is closed
|
||||
static void timer_fn(void *arg) {
|
||||
struct mg_mgr *mgr = (struct mg_mgr *) arg;
|
||||
struct mg_mqtt_opts opts = {.qos = s_qos,
|
||||
struct mg_mqtt_opts opts = {.clean = true,
|
||||
.will_qos = s_qos,
|
||||
.will_topic = mg_str(s_pub_topic),
|
||||
.will_message = mg_str("goodbye")};
|
||||
if (s_conn == NULL) s_conn = mg_mqtt_connect(mgr, s_url, &opts, fn, NULL);
|
||||
|
||||
@@ -28,7 +28,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
} else if (ev == MG_EV_WS_OPEN) {
|
||||
// WS connection established. Perform MQTT login
|
||||
LOG(LL_INFO, ("Connected to WS. Logging in to MQTT..."));
|
||||
struct mg_mqtt_opts opts = {.qos = 1,
|
||||
struct mg_mqtt_opts opts = {.will_qos = 1,
|
||||
.will_topic = mg_str(s_topic),
|
||||
.will_message = mg_str("goodbye")};
|
||||
size_t len = c->send.len;
|
||||
|
||||
Reference in new issue
Block a user