#pragma once #include "WHISPER/threadSafeQueue.hpp" #include "zmq.hpp" #include #include #include #include #include #include #include namespace DirectCommunication { class DirectCommunicationServer { public: DirectCommunicationServer(ushort port); ~DirectCommunicationServer(); void sendMessage(std::string msg); std::string getLatestMessage(); int countClients(); private: ushort port_; zmq::context_t context_; zmq::socket_t socket_; void workerFunc_(); std::thread Worker_; std::atomic_bool stopWorker_; WHISPER::threadSafeQueue receivedMessages_; std::vector connectedClients_; bool hasClient(std::uint32_t clientId); }; }