main.cpp 488 Bytes

#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;
}