Stormancer::IConnection Class Referenceabstract

Interface of a network connection. More...

#include <IConnection.h>

Public Member Functions

virtual void send (const StreamWriter &streamWriter, int channelUid, PacketPriority priority=PacketPriority::MEDIUM_PRIORITY, PacketReliability reliability=PacketReliability::RELIABLE_ORDERED, const TransformMetadata &transformMetadata=TransformMetadata())=0
 
virtual void setApplication (std::string account, std::string application)=0
 
virtual void close (std::string reason="")=0
 Close the connection.
 
virtual std::string ipAddress () const =0
 Returns the ip address of the remote peer.
 
virtual int ping () const =0
 
virtual std::string key () const =0
 
virtual time_t connectionDate () const =0
 Returns the connection date.
 
virtual const std::string & account () const =0
 Returns the account id of the application to which this connection is connected.
 
virtual const std::string & application () const =0
 Returns the id of the application to which this connection is connected.
 
virtual const std::unordered_map< std::string, std::string > metadata () const =0
 
virtual std::string metadata (const std::string &key) const =0
 
virtual void setMetadata (const std::unordered_map< std::string, std::string > &metadata)=0
 
virtual void setMetadata (const std::string &key, const std::string &value)=0
 
virtual pplx::task< void > updatePeerMetadata (pplx::cancellation_token=pplx::cancellation_token::none())
 
virtual const DependencyScopedependencyResolver () const =0
 
virtual ConnectionState getConnectionState () const =0
 Returns the connection state.
 
virtual rxcpp::observable< ConnectionStategetConnectionStateChangedObservable () const =0
 
virtual pplx::task< void > setTimeout (std::chrono::milliseconds, bool=true, pplx::cancellation_token=pplx::cancellation_token::none())
 
virtual std::string sessionId () const =0
 
virtual bool trySetInitialSceneConnection ()=0
 Test-and-set whether this connection has already been used to connect to a scene. More...
 

Public Attributes

Event< std::string > onClose
 

Protected Member Functions

virtual void setSessionId (const std::string &sessionId)=0
 
virtual void setConnectionState (ConnectionState connectionState)=0
 

Friends

class ConnectionsRepository
 
class P2PRequestModule
 

Detailed Description

Interface of a network connection.

Member Function Documentation

◆ send()

virtual void Stormancer::IConnection::send ( const StreamWriter &  streamWriter,
int  channelUid,
PacketPriority  priority = PacketPriority::MEDIUM_PRIORITY,
PacketReliability  reliability = PacketReliability::RELIABLE_ORDERED,
const TransformMetadata transformMetadata = TransformMetadata() 
)
pure virtual

Sends a system msg to the remote peer.

Parameters
streamWriterA function to write in the stream.
priorityThe priority of the message.
reliabilityThe reliability of the message.

◆ setApplication()

virtual void Stormancer::IConnection::setApplication ( std::string  account,
std::string  application 
)
pure virtual

Set the account id and the application name.

Parameters
accountThe account id.
applicationThe application name.

◆ trySetInitialSceneConnection()

virtual bool Stormancer::IConnection::trySetInitialSceneConnection ( )
pure virtual

Test-and-set whether this connection has already been used to connect to a scene.

This check is useful if you want to perform some operations only the first time the connection connects to a scene.

Returns
true if this is the first scene that this connection is connecting to, false otherwise.

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