AetherPlugin.Repclient Class Reference

Repclication client. More...

Public Member Functions

void AuthenticatePlayerId (ulong id)
 Authenticate as a player with an ID. More...
 
void AuthenticatePlayerIdWithToken (ulong id, string token)
 Authenticate as a player with an ID - verification with a 32 character token on the muxer side. More...
 
bool SendEvent (byte[] data, bool blocking)
 Asynchronyously send an event to the simulation More...
 
bool IsConnected ()
 Returns true if connection is still valid. More...
 
byte[] ReceiveMessage ()
 Attempt to return a message from the incoming message buffer. More...
 
unsafe UnsafeSpan UnsafeReceiveMessage ()
 Attempt to return a message from the incoming message buffer. More...
 
void Dispose ()
 Free the native resources allocated by the object. More...
 

Static Public Member Functions

static Repclient Connection (string host, string port)
 A repclient instance connected to a given host/port. More...
 
static Repclient RecordConnection (string host, string port, string recordingFile)
 A repclient instance connected to a given host/port, which stores the messages received to a recording file. More...
 
static Repclient ReplayRecordedConnection (String recordingFile)
 A repclient instance replaying the connection from a file. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Detailed Description

Repclication client.

Responsible for authentication and communication with the Aether simulation.

Member Function Documentation

void AetherPlugin.Repclient.AuthenticatePlayerId ( ulong  id)
inline

Authenticate as a player with an ID.

Authentication is asynchronyous, authentication failure will disconnect this client (it might take time to propagate the disconnect). More than 1 client with the same id can be connected at one time, the output of the simulation will be replicated to all.

Parameters
idplayer's id
void AetherPlugin.Repclient.AuthenticatePlayerIdWithToken ( ulong  id,
string  token 
)
inline

Authenticate as a player with an ID - verification with a 32 character token on the muxer side.

Authentication is asynchronyous, authentication failure will disconnect this client (it might take time to propagate the disconnect). More than 1 client with the same id can be connected at one time, the output of the simulation will be replicated to all.

Parameters
idplayer's id
token32-char long token; not null
static Repclient AetherPlugin.Repclient.Connection ( string  host,
string  port 
)
inlinestatic

A repclient instance connected to a given host/port.

Blocks until a connection is established or a timeout reached.

Parameters
hostmuxer hostname to connect to; not null
portmuxer port to connect to (usually 8881); not null
Returns
a connected repclient instance or null if connection failed
void AetherPlugin.Repclient.Dispose ( )
inline

Free the native resources allocated by the object.

virtual void AetherPlugin.Repclient.Dispose ( bool  disposing)
inlineprotectedvirtual
bool AetherPlugin.Repclient.IsConnected ( )
inline

Returns true if connection is still valid.

Returns
byte [] AetherPlugin.Repclient.ReceiveMessage ( )
inline

Attempt to return a message from the incoming message buffer.

The buffer is populated asynchronyously in a native background thread.

Returns
Next available update message, or null if no messages have been received
static Repclient AetherPlugin.Repclient.RecordConnection ( string  host,
string  port,
string  recordingFile 
)
inlinestatic

A repclient instance connected to a given host/port, which stores the messages received to a recording file.

Blocks until a connection is established or a timeout reached.

Parameters
hostmuxer hostname to connect to; not null
portmuxer port to connect to (usually 8881); not null
recordingFilepath to a recording file; not null
Returns
a connected repclient instance or null if connection failed
static Repclient AetherPlugin.Repclient.ReplayRecordedConnection ( String  recordingFile)
inlinestatic

A repclient instance replaying the connection from a file.

Parameters
recordingFilepath to a recording file; not null
Returns
a connected repclient instance or null if connection failed
bool AetherPlugin.Repclient.SendEvent ( byte[]  data,
bool  blocking 
)
inline

Asynchronyously send an event to the simulation

Parameters
databinary blob to send; not null
blockingif set to false, the event might be dropped when the sending buffer is full
Returns
true if the event has been successfully queued for sending (always true when blocking set to true)
unsafe UnsafeSpan AetherPlugin.Repclient.UnsafeReceiveMessage ( )
inline

Attempt to return a message from the incoming message buffer.

The buffer is populated asynchronyously in a native background thread.

Returns
Next available update message, or null if no messages have been received. The returned memory is unmanaged and will stop being valid after the next call to ReceiveMessage is made or the object is deleted.