Show / Hide Table of Contents

Interface IClientManager<TKey, TClient>

Manages connections lifetime to the selected keys.

Inherited Members
ICanDisconnect<TKey>.DisconnectAsync(IEnumerable<TKey>)
ICanDisconnect<TKey>.Disconnect(IEnumerable<TKey>)
ICanDisconnect<TKey>.DisconnectAsync(TKey)
ICanDisconnect<TKey>.Disconnect(TKey)
IHoldsBaggage<TKey>.GetBaggage<TBaggage>(TKey)
IHoldsBaggage<TKey>.GetAllBaggage<TBaggage>()
Namespace: Microsoft.XboxStudios.ClientManager
Assembly: ClientManager.Abstractions.dll
Syntax
public interface IClientManager<TKey, TClient> : IClientManager<TKey>, ICanDisconnect<TKey>, IHoldsBaggage<TKey> where TKey : notnull where TClient : class
Type Parameters
Name Description
TKey

The key to use to identify a specific client.

TClient

The type of the client used for connections.

Remarks

If using client manager as a singleton, make sure to unsubscribe from its events on cleanup.

Methods

View Source

CreateScope()

Creates a connection scope to manage reservations.

Declaration
IConnectionScope<TKey, TClient> CreateScope()
Returns
Type Description
IConnectionScope<TKey, TClient>

A connection scope.

View Source

NeedsToConnect(TClient)

Checks whether a client needs to connect or not.

Declaration
bool NeedsToConnect(TClient client)
Parameters
Type Name Description
TClient client

The client to check for.

Returns
Type Description
bool

True if client needs to connect. False otherwise.

View Source

Reserve(TKey)

Reserves the client for a specific TKey. Callers are responsible to dispose of the reserved client.

Declaration
Reserved<TClient>? Reserve(TKey key)
Parameters
Type Name Description
TKey key

The key to use.

Returns
Type Description
Reserved<TClient>

The client assosciated with the requested key.

View Source

ReserveAndConnectAsync(TKey, CancellationOptions?)

Reserves the client for a specific TKey and establishes connection if necessary. Callers are responsible to dispose of the reserved client.

Declaration
ValueTask<Reserved<TClient>?> ReserveAndConnectAsync(TKey key, CancellationOptions? co = null)
Parameters
Type Name Description
TKey key

The key to use.

CancellationOptions? co

The Microsoft.XboxStudios.Bifrost.CancellationOptions.

Returns
Type Description
ValueTask<Reserved<TClient>>

The client assosciated with the requested key. Null if connection failed.

Events

View Source

OnConnected

Event triggered when client has connected.

Declaration
event EventHandler<TClient>? OnConnected
Event Type
Type Description
EventHandler<TClient>
View Source

OnConnecting

Event triggered when client is connecting.

Declaration
event EventHandler<TClient>? OnConnecting
Event Type
Type Description
EventHandler<TClient>
View Source

OnConnectionChanged

Event triggered when connection changes on a client.

Declaration
event EventHandler<(TKey Key, TClient Client)>? OnConnectionChanged
Event Type
Type Description
EventHandler<(TKey Key, TClient Client)>
View Source

OnDisconnected

Event triggered when client has disconnected.

Declaration
event EventHandler<TClient>? OnDisconnected
Event Type
Type Description
EventHandler<TClient>
View Source

OnDisconnecting

Event triggered when client is disconnecting.

Declaration
event EventHandler<TClient>? OnDisconnecting
Event Type
Type Description
EventHandler<TClient>
  • View Source
In this article
Back to top Generated by DocFX