FIX: fixed some issues with subscribung and unsubscribing from topics
This commit is contained in:
33
src/main.cpp
33
src/main.cpp
@@ -1,7 +1,6 @@
|
||||
#include "WHISPER/InternalUDPService.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/Track.hpp"
|
||||
#include "zmq.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <loguru.hpp>
|
||||
|
||||
@@ -48,34 +47,34 @@ int main()
|
||||
service.connect(receiver);
|
||||
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
|
||||
// service.publish(join.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
|
||||
|
||||
|
||||
WHISPER::RawTrack RawTrack(ID,WHISPER::MsgTopics::TRACK,WHISPER::SourceType::SHIP,0001);
|
||||
// WHISPER::RawTrack RawTrack(ID,WHISPER::MsgTopics::TRACK,WHISPER::SourceType::SHIP,0001);
|
||||
|
||||
int size = 0;
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
|
||||
service.publish(RawTrack.serialize(),WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
// service.publish(RawTrack.serialize(),WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
while (running) {
|
||||
// zmq::message_t msg(string.begin(),string.end());
|
||||
// msg.set_group("data");
|
||||
// sock.send(msg,zmq::send_flags::none);
|
||||
// while (running) {
|
||||
// // zmq::message_t msg(string.begin(),string.end());
|
||||
// // msg.set_group("data");
|
||||
// // sock.send(msg,zmq::send_flags::none);
|
||||
|
||||
if (size != receiver->size()) {
|
||||
LOG_S(INFO)<<"received messages " << size;
|
||||
size = receiver->size();
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
// // if (size != receiver->size()) {
|
||||
// // LOG_S(INFO)<<"received messages " << size;
|
||||
// // size = receiver->size();
|
||||
// // }
|
||||
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
// }
|
||||
|
||||
|
||||
service.disconnect();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user