WhisperCom/src/main.cpp

29 lines
650 B
C++

#include "TestMessage.pb.h"
#include "WhisperCom/Service.hpp"
#include <thread>
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
int main(int argc, char **argv)
{
using namespace std::chrono_literals;
WhisperCom::Service service{};
service.subscribe("test");
std::this_thread::sleep_for(2000ms);
WhisperCom::Protobuf::TestMessage msg;
msg.set_str("Hello World");
WhisperCom::Protobuf::Message wmsg{};
wmsg.mutable_payload()->PackFrom(msg);
service.sendMessage("test", wmsg);
std::this_thread::sleep_for(60000ms);
service.stop();
DLOG_S(INFO) << "programm terminated";
return 0;
}