Simple Web Game Server  0.1
A C++ library for creating authenticated scalable backends for multiplayer web games.
Classes | Public Member Functions | List of all members
simple_web_game_server::client< client_config > Class Template Reference

A simple WebSocket client to connect to an instance of base_server. More...

#include <client.hpp>

Classes

class  client_error
 The class representing errors with the client. More...
 

Public Member Functions

 client ()
 Constructs the client with empty handler functions.
 
 client (std::function< void()> of, std::function< void()> cf, std::function< void(const std::string &)> mf)
 Constructs the client with the given handler functions.
 
 client (const client &c)
 
void connect (const std::string &uri, const std::string &jwt)
 Connects to a server at the given URI and sends the given string.
 
bool is_running ()
 Returns whether the underlying WebSocket client is running.
 
bool has_failed ()
 Returns whether the connection has failed.
 
void disconnect ()
 Close the connection to the server.
 
void reset ()
 Resets the client so it may connect to a new server.
 
void send (const std::string &msg)
 Synchronously send the given string to the server.
 
void set_open_handler (std::function< void()> f)
 Sets the given function to be called when the client connects.
 
void set_close_handler (std::function< void()> f)
 Sets the given function to be called when the client disconnects.
 
void set_message_handler (std::function< void(const std::string &)> f)
 Sets the given function to be called when the client gets a message.
 

Detailed Description

template<typename client_config>
class simple_web_game_server::client< client_config >

A simple WebSocket client to connect to an instance of base_server.


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