Public Types

using SceneInitializer = std::function< void(std::shared_ptr< Scene >)>
 

Public Member Functions

virtual pplx::task< std::shared_ptr< Scene > > connectToPublicScene (const std::string &sceneId, const SceneInitializer &initializer=SceneInitializer(), pplx::cancellation_token ct=pplx::cancellation_token::none())=0
 Connect to an existing public scene on the server application. More...
 
virtual pplx::task< std::shared_ptr< Scene > > connectToPrivateScene (const std::string &sceneToken, const SceneInitializer &initializer=SceneInitializer(), pplx::cancellation_token ct=pplx::cancellation_token::none())=0
 Connect to an existing private scene on the server application. More...
 
virtual pplx::task< void > disconnect (pplx::cancellation_token ct=pplx::cancellation_token::none())=0
 Disconnect from the server application and from every scene this client is connected to. More...
 
virtual int64 clock () const =0
 Gets sync clock value. More...
 
virtual int64 lastPing () const =0
 Get last ping from sync clock. More...
 
virtual DependencyScopedependencyResolver ()=0
 Gets the client's dependency resolver. More...
 
virtual void setMetadata (const std::string &key, const std::string &value)=0
 Sets a value in the connection metadata. More...
 
virtual pplx::task< int > pingCluster (std::string clusterId, pplx::cancellation_token ct=pplx::cancellation_token::none())=0
 Gets the ping to a cluster in the federation. More...
 
virtual pplx::task< FederationgetFederation (pplx::cancellation_token ct=pplx::cancellation_token::none())=0
 Gets informations about the federation the client is connected to. More...
 
virtual pplx::task< void > setServerTimeout (std::chrono::milliseconds timeout, pplx::cancellation_token ct=pplx::cancellation_token::none())=0
 Sets the timeout duration for the server connection. More...
 
virtual std::string sessionId ()=0
 Gets the current session id of the client. More...
 

Static Public Member Functions

static std::shared_ptr< IClientcreate (Configuration_ptr config)
 Factory method that constructs an IClient from a Configuration. More...
 

Member Function Documentation

◆ clock()

virtual int64 Stormancer::IClient::clock ( ) const
pure virtual

Gets sync clock value.

◆ connectToPrivateScene()

virtual pplx::task<std::shared_ptr<Scene> > Stormancer::IClient::connectToPrivateScene ( const std::string &  sceneToken,
const SceneInitializer &  initializer = SceneInitializer(),
pplx::cancellation_token  ct = pplx::cancellation_token::none() 
)
pure virtual

Connect to an existing private scene on the server application.

Parameters
sceneTokenAuthentication token needed to connect to the private scene
sceneIdId (name) of the scene
initializerCallback used to register route handlers on the scene
ctToken that can be used to cancel the connection while it is still in progress
Returns
A pplx::task that completes when the connection to the scene is established

◆ connectToPublicScene()

virtual pplx::task<std::shared_ptr<Scene> > Stormancer::IClient::connectToPublicScene ( const std::string &  sceneId,
const SceneInitializer &  initializer = SceneInitializer(),
pplx::cancellation_token  ct = pplx::cancellation_token::none() 
)
pure virtual

Connect to an existing public scene on the server application.

Parameters
sceneIdId (name) of the scene
initializerCallback used to register route handlers on the scene
ctToken that can be used to cancel the connection while it is still in progress
Returns
A pplx::task that completes when the connection to the scene is established

◆ create()

static std::shared_ptr<IClient> Stormancer::IClient::create ( Configuration_ptr  config)
static

Factory method that constructs an IClient from a Configuration.

Parameters
configConfiguration object containing parameters for the client to be created
Returns

◆ dependencyResolver()

virtual DependencyScope& Stormancer::IClient::dependencyResolver ( )
pure virtual

Gets the client's dependency resolver.

Returns

◆ disconnect()

virtual pplx::task<void> Stormancer::IClient::disconnect ( pplx::cancellation_token  ct = pplx::cancellation_token::none())
pure virtual

Disconnect from the server application and from every scene this client is connected to.

Returns

◆ getFederation()

virtual pplx::task<Federation> Stormancer::IClient::getFederation ( pplx::cancellation_token  ct = pplx::cancellation_token::none())
pure virtual

Gets informations about the federation the client is connected to.

Parameters
ctToken to cancel the request
Returns
A pplx::task containing the requested information

◆ lastPing()

virtual int64 Stormancer::IClient::lastPing ( ) const
pure virtual

Get last ping from sync clock.

◆ pingCluster()

virtual pplx::task<int> Stormancer::IClient::pingCluster ( std::string  clusterId,
pplx::cancellation_token  ct = pplx::cancellation_token::none() 
)
pure virtual

Gets the ping to a cluster in the federation.

Parameters
clusterIdId of the cluster to ping
ctToken to cancel the ping request
Returns
A pplx::task containing the ping value in milliseconds, that completes when the ping operation finishes.

◆ sessionId()

virtual std::string Stormancer::IClient::sessionId ( )
pure virtual

Gets the current session id of the client.

Returns
The session id if connected, an empty string otherwise.

◆ setMetadata()

virtual void Stormancer::IClient::setMetadata ( const std::string &  key,
const std::string &  value 
)
pure virtual

Sets a value in the connection metadata.

Parameters
keyMetadata key
valueMatadata value

◆ setServerTimeout()

virtual pplx::task<void> Stormancer::IClient::setServerTimeout ( std::chrono::milliseconds  timeout,
pplx::cancellation_token  ct = pplx::cancellation_token::none() 
)
pure virtual

Sets the timeout duration for the server connection.

Parameters
timeoutTimeout value
ctToken to cancel the request
Returns
A pplx::task that completes when the request is done

The documentation for this class was generated from the following file:
  • stormancer/stormancer-sources/include/public/stormancer/IClient.h