Blame view

examples/connect/main.cpp 488 Bytes
9421324b   Peter M. Groen   First fix on conn...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  
  #include <iostream>
  #include <unistd.h>
  
  #include "mqttclient.h"
  
  using namespace osdev::components::mqtt;
  
  int main( int argc, char* argv[] )
  {
      (void)argc;
      (void)argv;
  
      MqttClient oClient( "ConnectionTest" );
      oClient.connect( "localhost", 1883, Credentials() );
  
      unsigned int nCount = 0;
  
      while(1)
      {
          std::cout << "[" << std::to_string(nCount++) << "] MQTT Client status : " << oClient.state() << std::endl;
          sleep( 1 );
      }
  
      return 0;
  }