Class ClientManagerAdapterBase<TKey, TClient>
Base implementation of a client manager adapter with keys that implement IGameConnect.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.XboxStudios.ClientManager
Assembly: ClientManager.dll
Syntax
public abstract class ClientManagerAdapterBase<TKey, TClient> : IClientManagerAdapter<TKey, TClient> where TKey : notnull where TClient : class, IGameConnect
Type Parameters
Name | Description |
---|---|
TKey | The key object that contains the |
TClient | The client type. |
Remarks
Initializes a new instance of the ClientManagerAdapterBase<TKey, TClient> class.
Constructors
View SourceClientManagerAdapterBase(ILogger<ClientManagerAdapterBase<TKey, TClient>>?)
Base implementation of a client manager adapter with keys that implement IGameConnect.
Declaration
protected ClientManagerAdapterBase(ILogger<ClientManagerAdapterBase<TKey, TClient>>? logger = null)
Parameters
Type | Name | Description |
---|---|---|
ILogger<ClientManagerAdapterBase<TKey, TClient>> | logger | The logger. |
Remarks
Initializes a new instance of the ClientManagerAdapterBase<TKey, TClient> class.
Methods
View SourceConnectAsync(TClient, CancellationOptions?)
Connects a client to a game instance.
Declaration
public virtual ValueTask ConnectAsync(TClient client, CancellationOptions? co = null)
Parameters
Type | Name | Description |
---|---|---|
TClient | client | The client to connect. |
CancellationOptions? | co | The Microsoft.XboxStudios.Bifrost.CancellationOptions. |
Returns
Type | Description |
---|---|
ValueTask | A Task that represents the asynchronous operation. |
CreateFor(TKey)
Gets the client for a specific TKey.
Declaration
public abstract TClient? CreateFor(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to use. |
Returns
Type | Description |
---|---|
TClient | The client assosciated with the requested key. |
Disconnect(TClient)
Disconnects a client from a game instance synchronously.
Declaration
public void Disconnect(TClient client)
Parameters
Type | Name | Description |
---|---|---|
TClient | client | The client to disconnect. |
DisconnectAsync(TClient)
Disconnects a client from a game instance asynchronously.
Declaration
public virtual ValueTask DisconnectAsync(TClient client)
Parameters
Type | Name | Description |
---|---|---|
TClient | client | The client to disconnect. |
Returns
Type | Description |
---|---|
ValueTask | A Task that represents the asynchronous operation. |
LogException(TClient?, Exception)
A log method used to log exceptions when connecting or disconnecting clients.
Declaration
public virtual void LogException(TClient? client, Exception e)
Parameters
Type | Name | Description |
---|---|---|
TClient | client | The client that experienced the exception. |
Exception | e | The exception that was thrown. |
NeedsToConnect(TClient)
Checks whether a client needs to connect or not.
Declaration
public 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. |