Skip to content

Commit

Permalink
#528 Wait for connection in the 'async_publish_time' example
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Jan 5, 2025
1 parent df82ee4 commit 2b8bfbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/async_publish_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const std::string DFLT_SERVER_URI{"mqtt://localhost:1883"};
const int QOS = 1;

// How often to sample the "data"
const auto SAMPLE_PERIOD = milliseconds(5);
const auto SAMPLE_PERIOD = 5ms;

// How much the "data" needs to change before we publish a new value.
const int DELTA_MS = 100;
Expand Down Expand Up @@ -133,7 +133,7 @@ int main(int argc, char* argv[])
// Note that we start the connection, but don't wait for completion.
// We configured to allow publishing before a successful connection.
cout << "Starting connection..." << endl;
cli.connect(connOpts);
cli.connect(connOpts)->wait();

auto top = mqtt::topic(cli, "data/time", QOS);
cout << "Publishing data..." << endl;
Expand Down

0 comments on commit 2b8bfbb

Please sign in to comment.