This class contains parameters needed to initialize and configure a IClient. More...

#include <Configuration.h>

Public Member Functions

void addServerEndpoint (const std::string &serverEndpoint)
 Add a candidate server endpoint. More...
 
std::vector< std::string > getApiEndpoint ()
 Get the list of candidate server endpoints for this Configuration. More...
 
void addPlugin (IPlugin *plugin)
 Add a plugin to the client. More...
 
const std::vector< IPlugin * > plugins ()
 Get the list of plugins in this Configuration. Use addPlugin() to add new plugins. More...
 
bool hasPublicIp ()
 Check whether this Configuration has a public IP address setup. More...
 
const std::string getIp_Port ()
 Return the IP:Port couple setup for this Configuration. More...
 
void clearServerEndpoints ()
 

Static Public Member Functions

static std::shared_ptr< Configurationcreate (const std::string &endpoint, const std::string &account, const std::string &application)
 Factory method for Configuration. Always use this method to instantiate Configuration. More...
 

Public Attributes

std::string account = ""
 A string containing the account name of the application. More...
 
std::string application = ""
 A string containing the name of the application. More...
 
uint16 maxPeers = 10
 Maximum number of remote peers that can connect with this client. More...
 
uint16 clientSDKPort = 0
 Port that this client's stormancer transport socket should bind to. By default, set to 0 for automatic attribution. More...
 
bool asynchronousDispatch = true
 Was used to enable or disable asynchrounous dispatch of received messages. Has no effect. If you want to control how message handlers are dispatched, use actionDispatcher instead. More...
 
int threadpoolSize = 10
 On non-Win32 platforms, set the size of the threadpool (number of threads) for the default dispatcher. More...
 
unsigned short serverGamePort = 7777
 Local application port for direct communication with other clients, as P2P host or dedicated server. More...
 
std::string dedicatedServerEndpoint
 If this stormancer client runs on a dedicated server, set this to the public IP of the server. This enables other clients to connect to it directly. More...
 
bool enableNatPunchthrough = true
 Disable or enable nat punch through on client side. More...
 
std::string forceTransportEndpoint = ""
 Force a specific endpoint. Configuration used to connect client directly by localhost address. More...
 
std::shared_ptr< IActionDispatcheractionDispatcher
 Provide a custom IActionDispatcher to control how event handlers are dispatched. More...
 
bool synchronisedClock = true
 Whether the Stormancer's synchronized clock should be enabled on this client or not. More...
 
int32 synchronisedClockInterval = 5000
 The interval between successive ping requests for the synchronized clock, in milliseconds. Default is 5000 ms. More...
 
EndpointSelectionMode endpointSelectionMode = EndpointSelectionMode::FALLBACK
 Set how an endpoint should be selected among the candidates. More...
 
ILogger_ptr logger
 Set the logger for this stormancer client. More...
 
std::chrono::milliseconds defaultTimeout = std::chrono::milliseconds(10000)
 The default timeout duration for Stormancer server connections. More...
 
std::vector< std::string > endpointRootCertificates
 Certificate chain to enable HTTPS connection to the stormancer server. More...
 
bool shoudInitializeNetworkLibraries = true
 On platforms that need specific initialization for their network libraries, set whether the Stormancer client should perform this initialization. More...
 
bool encryptionEnabled = false
 Set whether the connection to the Stormancer server should be encrypted. More...
 
uint16 tunnelPort = 0
 If using the P2P tunnel, set the port the tunnel will be bound to for clients. More...
 
bool useIpv6Tunnel = false
 Whether the tunnel's socket should use IPv4 or IPv6. NOTE: IPv6 support is experimental. More...
 
std::unordered_map< std::string, std::string > additionalParameters
 Key => Value pair of parameters that can be used by plugins. More...
 
std::unordered_map< std::string, std::string > additionalHeaders
 Headers sent to the cluster when doing http requests. These headers can be used as parameters for application selection when using application aliases. More...
 

Friends

class Client
 

Detailed Description

This class contains parameters needed to initialize and configure a IClient.

Creating a Configuration using Configuration::create() is the first step before creating a IClient to start using Stormancer functionality.

Member Function Documentation

◆ addPlugin()

void Stormancer::Configuration::addPlugin ( IPlugin plugin)

Add a plugin to the client.

Plugins enable developers to plug custom code in the stormancer client's extensibility points. Possible uses include: custom high level protocols, logger or analyzers.

Parameters
pluginThe plugin instance to add. It must be dynamically allocated by you, and will be freed by the Configuration when it is destroyed.

◆ addServerEndpoint()

void Stormancer::Configuration::addServerEndpoint ( const std::string &  serverEndpoint)

Add a candidate server endpoint.

Parameters
serverEndpointHTTP endpoint to add to the list of candidates.

◆ create()

static std::shared_ptr<Configuration> Stormancer::Configuration::create ( const std::string &  endpoint,
const std::string &  account,
const std::string &  application 
)
inlinestatic

Factory method for Configuration. Always use this method to instantiate Configuration.

Parameters
endpointHTTP endpoint of the Stormancer cluster to connect to. Once the configuration is instantiated, you can add more candidate endpoints by calling addServerEndpoint().
accountStormancer account to use on the cluster.
applicationName of the Stormancer application to connect to. It must belong to the chosen account.
Returns
A Configuration std::shared_ptr with the supplied parameters.

◆ getApiEndpoint()

std::vector<std::string> Stormancer::Configuration::getApiEndpoint ( )

Get the list of candidate server endpoints for this Configuration.

Returns
List of candidate endpoints.

◆ getIp_Port()

const std::string Stormancer::Configuration::getIp_Port ( )

Return the IP:Port couple setup for this Configuration.

Returns
A std::string in the ip:port format.

◆ hasPublicIp()

bool Stormancer::Configuration::hasPublicIp ( )

Check whether this Configuration has a public IP address setup.

This is typically used for dedicated game servers. To set the public IP for the Configuration, use the dedicatedServerEndpoint member variable.

Returns
true if this Configuration has a public IP setup.

◆ plugins()

const std::vector<IPlugin*> Stormancer::Configuration::plugins ( )

Get the list of plugins in this Configuration. Use addPlugin() to add new plugins.

Returns
The Configuration's list of plugins.

Member Data Documentation

◆ account

std::string Stormancer::Configuration::account = ""

A string containing the account name of the application.

◆ actionDispatcher

std::shared_ptr<IActionDispatcher> Stormancer::Configuration::actionDispatcher

Provide a custom IActionDispatcher to control how event handlers are dispatched.

By default, events are dispatched on the current network thread. Replace the dispatcher with a MainThreadActionDispatcher to dispatch to your main thread. your main game loop for instance. An event can be an incoming route message, an RPC response, a subscription notification, etc. Generally, it is anything in the Stormancer API that you can register a handler for, be it a pplx::task continuation, an Action, an Event or an rxcpp::subscription.

◆ additionalHeaders

std::unordered_map<std::string, std::string> Stormancer::Configuration::additionalHeaders

Headers sent to the cluster when doing http requests. These headers can be used as parameters for application selection when using application aliases.

remarks> See http://docs.stormancer.com/grid/applicationAliases.html for more information about application aliases. /remarks>

◆ additionalParameters

std::unordered_map<std::string, std::string> Stormancer::Configuration::additionalParameters

Key => Value pair of parameters that can be used by plugins.

This can hold any string-based value. For instance, it could be used to hold parameters for platform-specific plugins.

◆ application

std::string Stormancer::Configuration::application = ""

A string containing the name of the application.

◆ asynchronousDispatch

bool Stormancer::Configuration::asynchronousDispatch = true

Was used to enable or disable asynchrounous dispatch of received messages. Has no effect. If you want to control how message handlers are dispatched, use actionDispatcher instead.

Deprecated:
Set a custom actionDispatcher instead.

◆ clientSDKPort

uint16 Stormancer::Configuration::clientSDKPort = 0

Port that this client's stormancer transport socket should bind to. By default, set to 0 for automatic attribution.

◆ dedicatedServerEndpoint

std::string Stormancer::Configuration::dedicatedServerEndpoint

If this stormancer client runs on a dedicated server, set this to the public IP of the server. This enables other clients to connect to it directly.

◆ defaultTimeout

std::chrono::milliseconds Stormancer::Configuration::defaultTimeout = std::chrono::milliseconds(10000)

The default timeout duration for Stormancer server connections.

◆ enableNatPunchthrough

bool Stormancer::Configuration::enableNatPunchthrough = true

Disable or enable nat punch through on client side.

◆ encryptionEnabled

bool Stormancer::Configuration::encryptionEnabled = false

Set whether the connection to the Stormancer server should be encrypted.

◆ endpointRootCertificates

std::vector<std::string> Stormancer::Configuration::endpointRootCertificates

Certificate chain to enable HTTPS connection to the stormancer server.

Set this if you use certificates for your Stormancer server HTTPS setup that are not trusted by default on your platform. This feature is not supported on Windows and Xbox.

◆ endpointSelectionMode

EndpointSelectionMode Stormancer::Configuration::endpointSelectionMode = EndpointSelectionMode::FALLBACK

Set how an endpoint should be selected among the candidates.

◆ forceTransportEndpoint

std::string Stormancer::Configuration::forceTransportEndpoint = ""

Force a specific endpoint. Configuration used to connect client directly by localhost address.

◆ logger

ILogger_ptr Stormancer::Configuration::logger

Set the logger for this stormancer client.

By default, it will be NullLogger, which doesn't print anything. There are a number of predefined loggers that you can pick from, or implement your own. ConsoleLogger FileLogger VisualStudioLogger

◆ maxPeers

uint16 Stormancer::Configuration::maxPeers = 10

Maximum number of remote peers that can connect with this client.

◆ serverGamePort

unsigned short Stormancer::Configuration::serverGamePort = 7777

Local application port for direct communication with other clients, as P2P host or dedicated server.

◆ shoudInitializeNetworkLibraries

bool Stormancer::Configuration::shoudInitializeNetworkLibraries = true

On platforms that need specific initialization for their network libraries, set whether the Stormancer client should perform this initialization.

Typically, you should set this to false if your application directly calls system network libraries, and initializes them before initializing the Stormancer client library.

◆ synchronisedClock

bool Stormancer::Configuration::synchronisedClock = true

Whether the Stormancer's synchronized clock should be enabled on this client or not.

◆ synchronisedClockInterval

int32 Stormancer::Configuration::synchronisedClockInterval = 5000

The interval between successive ping requests for the synchronized clock, in milliseconds. Default is 5000 ms.

◆ threadpoolSize

int Stormancer::Configuration::threadpoolSize = 10

On non-Win32 platforms, set the size of the threadpool (number of threads) for the default dispatcher.

◆ tunnelPort

uint16 Stormancer::Configuration::tunnelPort = 0

If using the P2P tunnel, set the port the tunnel will be bound to for clients.

This will have no effect on P2P hosts, as multiple clients can be connected to them.

◆ useIpv6Tunnel

bool Stormancer::Configuration::useIpv6Tunnel = false

Whether the tunnel's socket should use IPv4 or IPv6. NOTE: IPv6 support is experimental.

This should match the IP version used by the game's socket when sending data to the tunnel. Note that binding the tunnel's socket will fail if you set this to true on a platform that has no IPv6 support.


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