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::matchmaking_server< matchmaker, jwt_clock, json_traits, server_config, close_reasons > Class Template Reference

A matchmaking server built on the base_server class. More...

#include <matchmaking_server.hpp>

Public Member Functions

 matchmaking_server (const jwt::verifier< jwt_clock, json_traits > &v, function< std::string(const combined_id &, const json &)> f, std::chrono::milliseconds t)
 The constructor for the matchmaking_server class. More...
 
 matchmaking_server (const jwt::verifier< jwt_clock, json_traits > &v, function< std::string(const combined_id &, const json &)> f)
 Constructs the underlying base_server with a default time-step.
 
void set_tls_init_handler (function< ssl_context_ptr(connection_hdl)> f)
 Sets the tls_init_handler for the underlying base_server.
 
void run (uint16_t port, bool unlock_address=false)
 Runs the underlying base_server.
 
void process_messages ()
 Runs the process_messages loop on the underlying base_server.
 
void reset ()
 Stops, clears, and resets the server so it may be run again.
 
void stop ()
 Stops the server and clears all data and connections.
 
std::size_t get_player_count ()
 Returns the number of verified clients connected.
 
bool is_running ()
 
void match_players (std::chrono::milliseconds timestep)
 Loop to match players. More...
 

Detailed Description

template<typename matchmaker, typename jwt_clock, typename json_traits, typename server_config, typename close_reasons = default_close_reasons>
class simple_web_game_server::matchmaking_server< matchmaker, jwt_clock, json_traits, server_config, close_reasons >

A matchmaking server built on the base_server class.

This class wraps an underlying base_server and performs matchmaking between connected client sessions.

Constructor & Destructor Documentation

◆ matchmaking_server()

template<typename matchmaker , typename jwt_clock , typename json_traits , typename server_config , typename close_reasons = default_close_reasons>
simple_web_game_server::matchmaking_server< matchmaker, jwt_clock, json_traits, server_config, close_reasons >::matchmaking_server ( const jwt::verifier< jwt_clock, json_traits > &  v,
function< std::string(const combined_id &, const json &)>  f,
std::chrono::milliseconds  t 
)
inline

The constructor for the matchmaking_server class.

The parameters are simply used to construct the underlying base_server.

Member Function Documentation

◆ match_players()

template<typename matchmaker , typename jwt_clock , typename json_traits , typename server_config , typename close_reasons = default_close_reasons>
void simple_web_game_server::matchmaking_server< matchmaker, jwt_clock, json_traits, server_config, close_reasons >::match_players ( std::chrono::milliseconds  timestep)
inline

Loop to match players.

Processes client connections and disconnections and matches connected client sessions together. It may also send out any messages broadcast by the matchmaking function. Should only be called by one thread.


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