Server
 All Data Structures Files Functions Variables
Public Member Functions | Data Fields
communication::MessageHandler Class Reference

#include <MessageHandler.hpp>

Public Member Functions

 MessageHandler (uint16_t port, util::Logging &log, const std::string &protocolName="")
 
virtual void send (const messages::Message &message, int client)
 
virtual void send (const messages::ReplayMessage &message, int client)
 
virtual ~MessageHandler ()=default
 

Data Fields

const util::Listener< int > onConnect
 
const util::Listener
< messages::Message, int > 
onReceive
 
const util::Listener< int > onClose
 

Detailed Description

The MessageHandler is responsible for the abstraction between the raw data from the Websocket and Message-Objects. Furthermore it provides an abstraction for connections.

Constructor & Destructor Documentation

communication::MessageHandler::MessageHandler ( uint16_t  port,
util::Logging &  log,
const std::string &  protocolName = "" 
)

CTor, create a new message handler.

Parameters
portthe port used for the websocket
loga reference to the logger
protocolNamethe name of the websocket protocol, "http-only" by default
See Also
Logger for more information on the Logger
virtual communication::MessageHandler::~MessageHandler ( )
virtualdefault

DTor, marks as virtual

Member Function Documentation

void communication::MessageHandler::send ( const messages::Message &  message,
int  client 
)
virtual

Send a message to the client specified by id

Parameters
messagethe message to send
clientthe client to which to send the message
void communication::MessageHandler::send ( const messages::ReplayMessage &  message,
int  client 
)
virtual

Send a replayMessage to the client specified by id

Parameters
messagethe replayMessage to send
clientthe client to which to send the message

Field Documentation

const util::Listener<int> communication::MessageHandler::onClose

Listener, that gets called when a client closes the connection

const util::Listener<int> communication::MessageHandler::onConnect

Listener that gets called on every new connection

const util::Listener<messages::Message,int> communication::MessageHandler::onReceive

Listener, that gets called on every new Message


The documentation for this class was generated from the following files: