Stormancer.RelayConnection Class Reference

Inherits Stormancer.Core.IConnection.

Public Member Functions

 RelayConnection (IConnection serverConnection, string address, ulong remotePeerId, P2PSessionId p2pSessionId, ISerializer serializer)
 
void Close (string reason="")
 Close the connection. More...
 
ConnectionStateCtx GetConnectionState ()
 
IObservable< ConnectionStateCtxGetConnectionStateChangedObservable ()
 
IConnectionStatistics GetConnectionStatistics ()
 
void SendSystem (Action< Stream > writer, int channelUid, PacketPriority priority=PacketPriority.MEDIUM_PRIORITY, PacketReliability reliability=PacketReliability.RELIABLE_ORDERED, TransformMetadata transformMetadata=default)
 Sends a system msg to the remote peer. More...
 
void SetApplication (string account, string application)
 Set the account id and the application name. More...
 
void SetConnectionState (ConnectionStateCtx connectionState)
 
async Task SetTimeout (TimeSpan timeout)
 
Task SetTimeout (TimeSpan timeout, CancellationToken token)
 
async Task UpdatePeerMetadata ()
 
Task UpdatePeerMetadata (CancellationToken token)
 
- Public Member Functions inherited from Stormancer.Core.IConnection
string ToString ()
 

Public Attributes

string IpAddress => _ipAddress
 
int Ping => _serverConnection.Ping
 
string Key => _p2pSessionId.ToString()
 
ulong Id => _remotePeerId
 
DateTime ConnectionDate => _connectionDate
 
string Account => _serverConnection.Account
 
string Application => _serverConnection.Application
 

Properties

IDependencyResolver DependencyResolver [get]
 
Dictionary< string, string > Metadata [get, set]
 
Action< string > OnClose [get, set]
 
- Properties inherited from Stormancer.Core.IConnection
string IpAddress [get]
 Ip address of the remote peer. More...
 
int Ping [get]
 The connection's Ping in milliseconds. More...
 
string Key [get]
 
IDependencyResolver DependencyResolver [get]
 
ulong Id [get]
 Unique id in the node for the connection. More...
 
DateTime ConnectionDate [get]
 Returns the connection date. More...
 
string Account [get]
 Account of the application which the peer is connected to. More...
 
string Application [get]
 Name of the application to which the peer is connected. More...
 
Dictionary< string, string > Metadata [get, set]
 Metadata associated with the connection. More...
 
Action< string > OnClose [get, set]
 Event fired when the connection has been closed. More...
 

Member Function Documentation

◆ Close()

void Stormancer.RelayConnection.Close ( string  reason = "")

Close the connection.

Parameters
reasonThe reason of the connection closing.

Implements Stormancer.Core.IConnection.

◆ SendSystem()

void Stormancer.RelayConnection.SendSystem ( Action< Stream >  writer,
int  channelUid,
PacketPriority  priority = PacketPriority.MEDIUM_PRIORITY,
PacketReliability  reliability = PacketReliability.RELIABLE_ORDERED,
TransformMetadata  transformMetadata = default 
)

Sends a system msg to the remote peer.

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

Implements Stormancer.Core.IConnection.

◆ SetApplication()

void Stormancer.RelayConnection.SetApplication ( string  account,
string  application 
)

Set the account id and the application name.

Parameters
accountThe account id.
applicationThe application name.

Implements Stormancer.Core.IConnection.


The documentation for this class was generated from the following file:
  • Stormancer.Unity/P2P/RelayConnection.cs