![]() |
ConnectX 3.0
ConnectX Game Suite
|
#include <connection.hpp>


Public Types | |
| using | MessageCallback = std::function< void(const std::string &)> |
| using | DisconnectCallback = std::function< void()> |
Public Member Functions | |
| Connection (sockpp::tcp_socket socket, uint32_t id) | |
| ~Connection () | |
| void | start () |
| bool | send (const std::string &message) |
| void | close () |
| bool | isOpen () const |
| uint32_t | getId () const |
| void | setMessageCallback (MessageCallback callback) |
| void | setDisconnectCallback (DisconnectCallback callback) |
Represents a single client connection Handles reading/writing messages to/from a client
| using Connection::DisconnectCallback = std::function<void()> |
| using Connection::MessageCallback = std::function<void(const std::string &)> |
|
explicit |
| Connection::~Connection | ( | ) |
| void Connection::close | ( | ) |
Close the connection
|
inline |
Get connection ID
|
inline |
Check if connection is open
| bool Connection::send | ( | const std::string & | message | ) |
Send a message to the client
|
inline |
Set callback for disconnection
|
inline |
Set callback for received messages
| void Connection::start | ( | ) |
Start reading from this connection (blocking in thread)