33#ifdef TTK_ENABLE_WEBSOCKETPP
36#define BOOST_ERROR_CODE_HEADER_ONLY
38#include <websocketpp/config/asio_no_tls.hpp>
39#include <websocketpp/server.hpp>
41using websocketpp::connection_hdl;
42using websocketpp::lib::thread;
44using con_list = std::set<connection_hdl, std::owner_less<connection_hdl>>;
45using WSServer = websocketpp::server<websocketpp::config::asio>;
60 Message(
const size_t &sizeInBytes,
const void *data)
76 const std::string &eventData =
"");
84 int sendBinary(
const size_t &sizeInBytes,
const void *data)
const;
88 int queueMessage(
const size_t &sizeInBytes,
const void *data);
95#ifdef TTK_ENABLE_WEBSOCKETPP
96 mutable WSServer server;
101 std::thread serverThread{};
102 con_list connections;
104 websocketpp::lib::error_code ec;
107 bool serverThreadRunning =
false;
110 int on_open(
const websocketpp::connection_hdl &hdl);
111 int on_close(
const websocketpp::connection_hdl &hdl);
112 int on_message(
const websocketpp::connection_hdl &hdl,
113 const WSServer::message_ptr &msg);
115 std::list<Message> messageQueue;
Minimalist debugging class.
int sendNextQueuedMessage()
int sendString(const std::string &msg) const
int sendMessage(const Message &msg) const
int queueMessage(const std::string &msg)
int sendBinary(const size_t &sizeInBytes, const void *data) const
int processMessageQueue()
virtual int processEvent(const std::string &eventName, const std::string &eventData="")
int startServer(int PortNumber)
Message(const Message &msg)
Message(const size_t &sizeInBytes, const void *data)
const void * binaryPayload
std::string stringPayload
Message(const std::string &msg)