#include <Communicator.hpp>
|
| | Communicator (MessageHandler &messageHandler, util::Logging &log, const messages::broadcast::MatchConfig &matchConfig) |
| |
| template<typename T > |
| void | send (const messages::AbstractMessage< T > &message, int id) |
| |
| void | removeClient (int id, const std::string &name) |
| |
| void | removeFromLobbyAfterLeft (bool lobbyEmpty, const std::string &userName, const std::string &lobbyName) |
| |
|
|
void | receive (const messages::Message &message, int client) |
| |
The communicator is responsible for managing player sessions and lobbys.
| communication::Communicator::Communicator |
( |
MessageHandler & |
messageHandler, |
|
|
util::Logging & |
log, |
|
|
const messages::broadcast::MatchConfig & |
matchConfig |
|
) |
| |
CTor: Start the communicator with a MessageHandler as a backend.
- Parameters
-
| messageHandler | the message handler to use to send and receive messages |
| log | the log object which to use |
| matchConfig | the matchConfig to use for all lobbies instantiated from this communicator |
| void communication::Communicator::removeClient |
( |
int |
id, |
|
|
const std::string & |
name |
|
) |
| |
Remove a client from the lobby, this is used by a lobby to kick a user.
| void communication::Communicator::removeFromLobbyAfterLeft |
( |
bool |
lobbyEmpty, |
|
|
const std::string & |
userName, |
|
|
const std::string & |
lobbyName |
|
) |
| |
Removes a client after a timeout and closes the lobby if empty
- Parameters
-
| lobbyEmpty | true if the player that left was the last player |
| userName | the name of the player |
| lobbyName | the name of the lobby |
template<typename T >
| void communication::Communicator::send |
( |
const messages::AbstractMessage< T > & |
message, |
|
|
int |
id |
|
) |
| |
Send an abstract message to the communicator
- Template Parameters
-
| T | type of the message payload |
- Parameters
-
| message | the message to send |
| id | the client to which the message should be sent |
The documentation for this class was generated from the following files: