Class BroadcastServer
Defined in File BroadcastServer.hpp
Class Documentation
-
class BroadcastServer
This BroadcastServer is a wrapper of a websocket server. User need to specify the api_msg_type, and provide a callback function. The provided callback will be called when the specified msg_type is received. Note that this will spawn a seperate thread to host the web socket server
Public Types
-
enum class ApiMsgType
Values:
-
enumerator TaskStateUpdate
-
enumerator TaskLogUpdate
-
enumerator FleetStateUpdate
-
enumerator FleetLogUpdate
-
enumerator TaskStateUpdate
-
using ApiMessageCallback = std::function<void(const nlohmann::json&)>
Public Static Functions
-
static std::shared_ptr<BroadcastServer> make(const int port, ApiMessageCallback callback, std::optional<ApiMsgType> msg_selection = std::nullopt)
Add a callback to convert from a Description into an active Task.
- Parameters:
port – [in] server url port number
callback – [in] callback function when the message is received
msg_selection – [in] selected msg type to listen. Will listen to all msg if nullopt
-
static const std::string to_string(const ApiMsgType &type)
Get the string name of the ApiMsgType.
-
enum class ApiMsgType