Skip to content

Commit

Permalink
print whether session was present
Browse files Browse the repository at this point in the history
  • Loading branch information
256dpi committed Feb 5, 2023
1 parent fda5824 commit fa0840d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ int main(void) {
// set options
lwmqtt_connect_options_t options = lwmqtt_default_connect_options;
options.client_id = lwmqtt_string("lwmqtt");
options.clean_session = false;
options.username = lwmqtt_string("public");
options.password = lwmqtt_string("public");
options.keep_alive = 10;
Expand All @@ -98,7 +99,7 @@ int main(void) {
}

// log
printf("connected!\n");
printf("connected! (session present: %d)\n", options.session_present);

// subscribe to topic
err = lwmqtt_subscribe_one(&client, lwmqtt_string("hello"), LWMQTT_QOS0, COMMAND_TIMEOUT);
Expand Down
3 changes: 2 additions & 1 deletion examples/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int main(void) {
// prepare options
lwmqtt_connect_options_t options = lwmqtt_default_connect_options;
options.client_id = lwmqtt_string("lwmqtt");
options.clean_session = false;
options.username = lwmqtt_string("public");
options.password = lwmqtt_string("public");
options.keep_alive = 5;
Expand All @@ -52,7 +53,7 @@ int main(void) {
}

// log
printf("connected!\n");
printf("connected! (session present: %d)\n", options.session_present);

// subscribe to topic
err = lwmqtt_subscribe_one(&client, lwmqtt_string("hello"), LWMQTT_QOS0, COMMAND_TIMEOUT);
Expand Down

0 comments on commit fa0840d

Please sign in to comment.