Table of Contents

Class CoherenceClientConnectionManager

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll
public class CoherenceClientConnectionManager
Inheritance
CoherenceClientConnectionManager

Properties

ClientConnectionCount

Returns the number of active client connections, including the local connection.

public int ClientConnectionCount { get; }

Property Value

int

Methods

Get(ClientID)

Returns a connection component associated with a given clientId, or null if the connection was not found. This is the same ClientID as in ClientId.

public CoherenceClientConnection Get(ClientID clientId)

Parameters

clientId ClientID

Returns

CoherenceClientConnection

Get(SerializeEntityID)

Returns a connection component associated with a given entityId, or null if the connection was not found.

public CoherenceClientConnection Get(SerializeEntityID entityId)

Parameters

entityId SerializeEntityID

Returns

CoherenceClientConnection

GetAll()

Returns a list of all client connections (both simulator and regular clients), including the local connection.

public IEnumerable<CoherenceClientConnection> GetAll()

Returns

IEnumerable<CoherenceClientConnection>

GetAllClients()

Returns a list of all client connections (with no simulators), including the local connection.

public IEnumerable<CoherenceClientConnection> GetAllClients()

Returns

IEnumerable<CoherenceClientConnection>

GetAllSimulators()

Returns a list of all simulator connections, including the local connection.

public IEnumerable<CoherenceClientConnection> GetAllSimulators()

Returns

IEnumerable<CoherenceClientConnection>

GetMine()

Returns a connection associated with this client. May return null if the connection system is turned off or the connection object was not instantiated yet.

public CoherenceClientConnection GetMine()

Returns

CoherenceClientConnection

GetOther()

Returns a list of all client connections (both simulator and regular clients) except for the local one.

public IEnumerable<CoherenceClientConnection> GetOther()

Returns

IEnumerable<CoherenceClientConnection>

GetOtherClients()

Returns a list of all client connections except for the local one.

public IEnumerable<CoherenceClientConnection> GetOtherClients()

Returns

IEnumerable<CoherenceClientConnection>

GetOtherSimulators()

Returns a list of all simulator connections except for the local one.

public IEnumerable<CoherenceClientConnection> GetOtherSimulators()

Returns

IEnumerable<CoherenceClientConnection>

GetSimulator()

Returns a connection associated with the simulator. May return null if the connection system is turned off or the connection object for the simulator was not instantiated yet.

public CoherenceClientConnection GetSimulator()

Returns

CoherenceClientConnection

SendMessage(Type, string, ClientID, MessageTarget, params object[])

Sends a client message to the connection whose ClientId matches the clientId.

public bool SendMessage(Type targetType, string methodName, ClientID clientId, MessageTarget target, params object[] args)

Parameters

targetType Type
methodName string
clientId ClientID
target MessageTarget
args object[]

Returns

bool

False if connection for a given clientId was not found, has no associated CoherenceSync, or if sending has failed.

SendMessage(Type, string, SerializeEntityID, MessageTarget, params object[])

Sends a client message to the connection whose EntityId matches the entityId.

public bool SendMessage(Type targetType, string methodName, SerializeEntityID entityId, MessageTarget target, params object[] args)

Parameters

targetType Type
methodName string
entityId SerializeEntityID
target MessageTarget
args object[]

Returns

bool

False if connection for a given entityId was not found, has no associated CoherenceSync, or if sending has failed.

SendMessageToAll(Type, string, MessageTarget, bool, params object[])

Sends a client message to every connection (both clients and simulators).

public bool SendMessageToAll(Type targetType, string methodName, MessageTarget target, bool sendToSelf, params object[] args)

Parameters

targetType Type
methodName string
target MessageTarget
sendToSelf bool
args object[]

Returns

bool

False if sending has failed for any of the clients.

SendMessageToAllClients(Type, string, MessageTarget, bool, params object[])

Sends a client message to every client connection.

public bool SendMessageToAllClients(Type targetType, string methodName, MessageTarget target, bool sendToSelf, params object[] args)

Parameters

targetType Type
methodName string
target MessageTarget
sendToSelf bool
args object[]

Returns

bool

False if sending has failed for any of the clients.

SendMessageToAllClients<TTarget>(string, MessageTarget, bool, params object[])

public bool SendMessageToAllClients<TTarget>(string methodName, MessageTarget target, bool sendToSelf, params object[] args) where TTarget : Component

Parameters

methodName string
target MessageTarget
sendToSelf bool
args object[]

Returns

bool

Type Parameters

TTarget

Type of the component that should receive this message.

SendMessageToAllSimulators(Type, string, MessageTarget, bool, params object[])

Sends a client message to every simulator connection.

public bool SendMessageToAllSimulators(Type targetType, string methodName, MessageTarget target, bool sendToSelf, params object[] args)

Parameters

targetType Type
methodName string
target MessageTarget
sendToSelf bool
args object[]

Returns

bool

False if sending has failed for any of the clients.

SendMessageToAllSimulators<TTarget>(string, MessageTarget, bool, params object[])

public bool SendMessageToAllSimulators<TTarget>(string methodName, MessageTarget target, bool sendToSelf, params object[] args) where TTarget : Component

Parameters

methodName string
target MessageTarget
sendToSelf bool
args object[]

Returns

bool

Type Parameters

TTarget

Type of the component that should receive this message.

SendMessageToAll<TTarget>(string, MessageTarget, bool, params object[])

public bool SendMessageToAll<TTarget>(string methodName, MessageTarget target, bool sendToSelf, params object[] args) where TTarget : Component

Parameters

methodName string
target MessageTarget
sendToSelf bool
args object[]

Returns

bool

Type Parameters

TTarget

Type of the component that should receive this message.

SendMessage<TTarget>(string, ClientID, MessageTarget, params object[])

public bool SendMessage<TTarget>(string methodName, ClientID clientId, MessageTarget target, params object[] args) where TTarget : Component

Parameters

methodName string
clientId ClientID
target MessageTarget
args object[]

Returns

bool

Type Parameters

TTarget

Type of the component that should receive this message.

SendMessage<TTarget>(string, SerializeEntityID, MessageTarget, params object[])

public bool SendMessage<TTarget>(string methodName, SerializeEntityID entityId, MessageTarget target, params object[] args) where TTarget : Component

Parameters

methodName string
entityId SerializeEntityID
target MessageTarget
args object[]

Returns

bool

Type Parameters

TTarget

Type of the component that should receive this message.

Events

OnCreated

Called when a new CoherenceClientConnection is synced, including the local connection.

public event Action<CoherenceClientConnection> OnCreated

Event Type

Action<CoherenceClientConnection>

OnDestroyed

Called when an existing CoherenceClientConnection is destroyed, including the local connection.

public event Action<CoherenceClientConnection> OnDestroyed

Event Type

Action<CoherenceClientConnection>

OnSynced

Called when all connections present at the moment of joining the session get synced.

public event Action<CoherenceClientConnectionManager> OnSynced

Event Type

Action<CoherenceClientConnectionManager>

ProvidePrefab

Called before creating the CoherenceClientConnection. Allows for providing custom objects to be used as CoherenceClientConnection. Takes precedence over the ClientConnectionPrefab. If no provider was subscribed or provider returns null, the ClientConnectionPrefab is used.

public event ClientConnectionPrefabProvider ProvidePrefab

Event Type

ClientConnectionPrefabProvider