Class HttpGameLiftApiClient
- Namespace
- Unity.Multiplayer.Core
IGameLiftApiClient over the GameLift service API (AWS JSON 1.1 RPC,
https://gamelift.<region>.amazonaws.com/, one X-Amz-Target: GameLift.<Action>
per call), signed with Unity.Multiplayer.Core.GameLiftSigV4 using the same long-term access key mp-host's
GameLiftProvisioner uses to create the fleet (HostingCredentialStore.AwsCreds). Field
names follow GameLift's publicly documented API as of this writing; as with the Edgegap/Gameye
clients, the opt-in real-provider smoke test (docs/articles/hosting/gamelift.md) is what
actually guards this against drift.
public sealed class HttpGameLiftApiClient : IGameLiftApiClient, IDisposable
- Inheritance
-
HttpGameLiftApiClient
- Implements
- Inherited Members
Constructors
HttpGameLiftApiClient(HttpClient, string, string, string, bool)
Uses client as already configured (base address); disposes it only when ownsClient is true.
public HttpGameLiftApiClient(HttpClient client, string accessKeyId, string secretAccessKey, string region, bool ownsClient = false)
Parameters
clientHttpClientaccessKeyIdstringsecretAccessKeystringregionstringownsClientbool
Exceptions
- ArgumentNullException
clientis null.- ArgumentException
A credential or the region is empty.
HttpGameLiftApiClient(string, string, string)
Talks to GameLift at https://gamelift.<region>.amazonaws.com/, signing every call with accessKeyId/secretAccessKey.
public HttpGameLiftApiClient(string accessKeyId, string secretAccessKey, string region)
Parameters
Exceptions
- ArgumentException
A credential or the region is empty.
Methods
CreateGameSessionAsync(GameLiftCreateGameSessionRequest, CancellationToken)
Starts a game session on a fleet (or through an alias), for one match.
public Task<GameLiftGameSession> CreateGameSessionAsync(GameLiftCreateGameSessionRequest request, CancellationToken cancellationToken = default)
Parameters
requestGameLiftCreateGameSessionRequestcancellationTokenCancellationToken
Returns
CreatePlayerSessionAsync(string, string, string, CancellationToken)
Reserves a seat on a session for one player. playerData is an optional, arbitrary string GameLift stores with the reservation.
public Task<GameLiftPlayerSession> CreatePlayerSessionAsync(string gameSessionId, string playerId, string playerData, CancellationToken cancellationToken = default)
Parameters
gameSessionIdstringplayerIdstringplayerDatastringcancellationTokenCancellationToken
Returns
DescribeGameSessionAsync(string, CancellationToken)
The session's current status and connection info.
public Task<GameLiftGameSession> DescribeGameSessionAsync(string gameSessionId, CancellationToken cancellationToken = default)
Parameters
gameSessionIdstringcancellationTokenCancellationToken
Returns
Dispose()
Disposes the HttpClient if this object created it.
public void Dispose()