AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Retrieves all active game sessions that match a set of search criteria and sorts them into a specified order.
This operation is not designed to continually track game session status because that practice can cause you to exceed your API limit and generate errors. Instead, configure an Amazon Simple Notification Service (Amazon SNS) topic to receive notifications from a matchmaker or a game session placement queue.
When searching for game sessions, you specify exactly where you want to search and provide a search filter expression, a sort expression, or both. A search request can search only one fleet, but it can search all of a fleet's locations.
This operation can be used in the following ways:
To search all game sessions that are currently running on all locations in a fleet, provide a fleet or alias ID. This approach returns game sessions in the fleet's home Region and all remote locations that fit the search criteria.
To search all game sessions that are currently running on a specific fleet location, provide a fleet or alias ID and a location name. For location, you can specify a fleet's home Region or any remote location.
Use the pagination parameters to retrieve results as a set of sequential pages.
If successful, a GameSession
object is returned for each game session that
matches the request. Search finds game sessions that are in ACTIVE
status only.
To retrieve information on game sessions in other statuses, use DescribeGameSessions
.
To set search and sort criteria, create a filter expression using the following game session attributes. For game session search examples, see the Examples section of this topic.
gameSessionId -- A unique identifier for the game session. You can use either
a GameSessionId
or GameSessionArn
value.
gameSessionName -- Name assigned to a game session. Game session names do not need to be unique to a game session.
gameSessionProperties -- A set of key-value pairs that can store custom data
in a game session. For example: {"Key": "difficulty", "Value": "novice"}
. The
filter expression must specify the GameProperty -- a Key
and a string
Value
to search for the game sessions.
For example, to search for the above key-value pair, specify the following search
filter: gameSessionProperties.difficulty = "novice"
. All game property values
are searched as strings.
For examples of searching game sessions, see the ones below, and also see Search game sessions by game property.
maximumSessions -- Maximum number of player sessions allowed for a game session.
creationTimeMillis -- Value indicating when a game session was created. It is expressed in Unix time as milliseconds.
playerSessionCount -- Number of players currently connected to a game session. This value changes rapidly as players join the session or drop out.
hasAvailablePlayerSessions -- Boolean value indicating whether a game session has reached its maximum number of players. It is highly recommended that all search requests include this filter attribute to optimize search performance and return only sessions that players can join.
Returned values for playerSessionCount
and hasAvailablePlayerSessions
change quickly as players join sessions and others drop out. Results should be considered
a snapshot in time. Be sure to refresh search results often, and handle sessions that
fill up before a player can join.
This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginSearchGameSessions and EndSearchGameSessions.
Namespace: Amazon.GameLift
Assembly: AWSSDK.GameLift.dll
Version: 3.x.y.z
public virtual Task<SearchGameSessionsResponse> SearchGameSessionsAsync( SearchGameSessionsRequest request, CancellationToken cancellationToken )
Container for the necessary parameters to execute the SearchGameSessions service method.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Exception | Condition |
---|---|
InternalServiceException | The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period. |
InvalidRequestException | One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying. |
NotFoundException | The requested resources was not found. The resource was either not created yet or deleted. |
TerminalRoutingStrategyException | The service is unable to resolve the routing for a particular alias because it has a terminal RoutingStrategy associated with it. The message returned in this exception is the message defined in the routing strategy itself. Such requests should only be retried if the routing strategy for the specified alias is modified. |
UnauthorizedException | The client failed authentication. Clients should not retry such requests. |
UnsupportedRegionException | The requested operation is not supported in the Region specified. |
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer