|
Eile Mit Weile
|
Responsible for sending ClientRequests issued by the GameController to the server. More...
#include <ClientNetworkManager.hpp>
Static Public Member Functions | |
| static void | Init (const std::string &host, const uint16_t port) |
| static void | SendRequest (const ClientRequest &request) |
| static void | ParseResponse (const std::string &message) |
Static Private Member Functions | |
| static bool | Connect (const std::string &host, const uint16_t port) |
Static Private Attributes | |
| static sockpp::tcp_connector * | _connection = nullptr |
| static bool | _connection_success = false |
| static bool | _failed_to_connect = false |
Responsible for sending ClientRequests issued by the GameController to the server.
Establishes a connection to the server at the given host and port. Uses sockpp to establish a tcp connection to the server. If the connection is successful, it returns true, otherwise false.
Initializes the ClientNetworkManager. We use sockpp to establish a connection to the server. See ClientNetworkManager::Connect. Updates the connection status in the status bar (see GameWindow::SetStatus).
Parses the given json message and updates the game state accordingly. Uses the static method ServerResponse::FromJson to construct a ServerResponse object from the given json string and calls the ServerResponse::Process method on the constructed object.
|
static |
Sends the given ClientRequest to the server.
|
staticprivate |
The tcp connection to the server.
True if the connection to the server was successful, otherwise false.
True if the connection to the server failed, otherwise false.