GameLiftStreams / Client / start_stream_session
start_stream_session#
- GameLiftStreams.Client.start_stream_session(**kwargs)#
This action initiates a new stream session and outputs connection information that clients can use to access the stream. A stream session refers to an instance of a stream that Amazon GameLift Streams transmits from the server to the end-user. A stream session runs on a compute resource, or stream capacity, that a stream group has allocated.
To start a new stream session, specify a stream group and application ID, along with the transport protocol and signal request settings to use with the stream. You must have associated at least one application to the stream group before starting a stream session, either when creating the stream group, or by using AssociateApplications.
For stream groups that have multiple locations, provide a set of locations ordered by priority by setting
Locations
. Amazon GameLift Streams will start a single stream session in the next available location. An application must be finished replicating in a remote location before the remote location can host a stream.If the request is successful, Amazon GameLift Streams begins to prepare the stream. Amazon GameLift Streams assigns an Amazon Resource Name (ARN) value to the stream session resource and sets the status to
ACTIVATING
. During the stream preparation process, Amazon GameLift Streams queues the request and searches for available stream capacity to run the stream. This can result to one of the following:Amazon GameLift Streams identifies an available compute resource to run the application content and start the stream. When the stream is ready, the stream session’s status changes to
ACTIVE
and includes stream connection information. Provide the connection information to the requesting client to join the stream session.Amazon GameLift Streams doesn’t identify an available resource within a certain time, set by
ClientToken
. In this case, Amazon GameLift Streams stops processing the request, and the stream session object status changes toERROR
with status reasonplacementTimeout
.
See also: AWS API Documentation
Request Syntax
response = client.start_stream_session( AdditionalEnvironmentVariables={ 'string': 'string' }, AdditionalLaunchArgs=[ 'string', ], ApplicationIdentifier='string', ClientToken='string', ConnectionTimeoutSeconds=123, Description='string', Identifier='string', Locations=[ 'string', ], Protocol='WebRTC', SessionLengthSeconds=123, SignalRequest='string', UserId='string' )
- Parameters:
AdditionalEnvironmentVariables (dict) –
A set of options that you can use to control the stream session runtime environment, expressed as a set of key-value pairs. You can use this to configure the application or stream session details. You can also provide custom environment variables that Amazon GameLift Streams passes to your game client.
Note
If you want to debug your application with environment variables, we recommend that you do so in a local environment outside of Amazon GameLift Streams. For more information, refer to the Compatibility Guidance in the troubleshooting section of the Developer Guide.
AdditionalEnvironmentVariables
andAdditionalLaunchArgs
have similar purposes.AdditionalEnvironmentVariables
passes data using environment variables; whileAdditionalLaunchArgs
passes data using command-line arguments.(string) –
(string) –
AdditionalLaunchArgs (list) –
A list of CLI arguments that are sent to the streaming server when a stream session launches. You can use this to configure the application or stream session details. You can also provide custom arguments that Amazon GameLift Streams passes to your game client.
AdditionalEnvironmentVariables
andAdditionalLaunchArgs
have similar purposes.AdditionalEnvironmentVariables
passes data using environment variables; whileAdditionalLaunchArgs
passes data using command-line arguments.(string) –
ApplicationIdentifier (string) –
[REQUIRED]
An Amazon Resource Name (ARN) or ID that uniquely identifies the application resource. Format example: ARN-
arn:aws:gameliftstreams:us-west-2:123456789012:application/9ZY8X7Wv6
or ID-9ZY8X7Wv6
.ClientToken (string) –
A unique identifier that represents a client request. The request is idempotent, which ensures that an API request completes only once. When users send a request, Amazon GameLift Streams automatically populates this field.
This field is autopopulated if not provided.
ConnectionTimeoutSeconds (integer) – Length of time (in seconds) that Amazon GameLift Streams should wait for a client to connect to the stream session. This time span starts when the stream session reaches
ACTIVE
status. If no client connects before the timeout, Amazon GameLift Streams stops the stream session with status ofTERMINATED
. Default value is 120.Description (string) – A human-readable label for the stream session. You can update this value later.
Identifier (string) –
[REQUIRED]
The stream group to run this stream session with.
This value is an Amazon Resource Name (ARN) or ID that uniquely identifies the stream group resource. Format example: ARN-
arn:aws:gameliftstreams:us-west-2:123456789012:streamgroup/1AB2C3De4
or ID-1AB2C3De4
.Locations (list) –
A list of locations, in order of priority, where you want Amazon GameLift Streams to start a stream from. Amazon GameLift Streams selects the location with the next available capacity to start a single stream session in. If this value is empty, Amazon GameLift Streams attempts to start a stream session in the primary location.
This value is A set of location names. For example,
us-east-1
. For a complete list of locations that Amazon GameLift Streams supports, see the Regions and quotas section in the Amazon GameLift Streams Developer Guide .</p>
(string) –
Protocol (string) –
[REQUIRED]
The data transport protocol to use for the stream session.
SessionLengthSeconds (integer) – The maximum length of time (in seconds) that Amazon GameLift Streams keeps the stream session open. At this point, Amazon GameLift Streams ends the stream session regardless of any existing client connections. Default value is 43200.
SignalRequest (string) –
[REQUIRED]
A WebRTC ICE offer string to use when initializing a WebRTC connection. The offer is a very long JSON string. Provide the string as a text value in quotes.
UserId (string) – An opaque, unique identifier for an end-user, defined by the developer.
- Return type:
dict
- Returns:
Response Syntax
{ 'AdditionalEnvironmentVariables': { 'string': 'string' }, 'AdditionalLaunchArgs': [ 'string', ], 'ApplicationArn': 'string', 'Arn': 'string', 'ConnectionTimeoutSeconds': 123, 'CreatedAt': datetime(2015, 1, 1), 'Description': 'string', 'ExportFilesMetadata': { 'OutputUri': 'string', 'Status': 'SUCCEEDED'|'FAILED'|'PENDING', 'StatusReason': 'string' }, 'LastUpdatedAt': datetime(2015, 1, 1), 'Location': 'string', 'LogFileLocationUri': 'string', 'Protocol': 'WebRTC', 'SessionLengthSeconds': 123, 'SignalRequest': 'string', 'SignalResponse': 'string', 'Status': 'ACTIVATING'|'ACTIVE'|'CONNECTED'|'PENDING_CLIENT_RECONNECTION'|'RECONNECTING'|'TERMINATING'|'TERMINATED'|'ERROR', 'StatusReason': 'internalError'|'invalidSignalRequest'|'placementTimeout'|'applicationLogS3DestinationError', 'StreamGroupId': 'string', 'UserId': 'string', 'WebSdkProtocolUrl': 'string' }
Response Structure
(dict) –
AdditionalEnvironmentVariables (dict) –
A set of options that you can use to control the stream session runtime environment, expressed as a set of key-value pairs. You can use this to configure the application or stream session details. You can also provide custom environment variables that Amazon GameLift Streams passes to your game client.
Note
If you want to debug your application with environment variables, we recommend that you do so in a local environment outside of Amazon GameLift Streams. For more information, refer to the Compatibility Guidance in the troubleshooting section of the Developer Guide.
AdditionalEnvironmentVariables
andAdditionalLaunchArgs
have similar purposes.AdditionalEnvironmentVariables
passes data using environment variables; whileAdditionalLaunchArgs
passes data using command-line arguments.(string) –
(string) –
AdditionalLaunchArgs (list) –
A list of CLI arguments that are sent to the streaming server when a stream session launches. You can use this to configure the application or stream session details. You can also provide custom arguments that Amazon GameLift Streams passes to your game client.
AdditionalEnvironmentVariables
andAdditionalLaunchArgs
have similar purposes.AdditionalEnvironmentVariables
passes data using environment variables; whileAdditionalLaunchArgs
passes data using command-line arguments.(string) –
ApplicationArn (string) –
An Amazon Resource Name (ARN) that uniquely identifies the application resource. Format example:
arn:aws:gameliftstreams:us-west-2:123456789012:application/9ZY8X7Wv6
.Arn (string) –
The Amazon Resource Name (ARN) assigned to the stream session resource. When combined with the stream group ARN, this value uniquely identifies it across all Amazon Web Services Regions. Format is
arn:aws:gameliftstreams:[AWS Region]:[AWS account]:streamsession/[resource ID]
.ConnectionTimeoutSeconds (integer) –
The maximum length of time (in seconds) that Amazon GameLift Streams keeps the stream session open. At this point, Amazon GameLift Streams ends the stream session regardless of any existing client connections.
CreatedAt (datetime) –
A timestamp that indicates when this resource was created. Timestamps are expressed using in ISO8601 format, such as:
2022-12-27T22:29:40+00:00
(UTC).Description (string) –
A human-readable label for the stream session. You can update this value at any time.
ExportFilesMetadata (dict) –
Provides details about the stream session’s exported files.
OutputUri (string) –
The S3 bucket URI where Amazon GameLift Streams uploaded the set of compressed exported files for a stream session. Amazon GameLift Streams generates a ZIP file name based on the stream session metadata. Alternatively, you can provide a custom file name with a
.zip
file extension.Example 1: If you provide an S3 URI called
s3://MyBucket/MyGame_Session1.zip
, then Amazon GameLift Streams will save the files at that location.Example 2: If you provide an S3 URI called
s3://MyBucket/MyGameSessions_ExportedFiles/
, then Amazon GameLift Streams will save the files ats3://MyBucket/MyGameSessions_ExportedFiles/YYYYMMDD-HHMMSS-appId-sg-Id-sessionId.zip
or another similar name.Status (string) –
The result of the ExportStreamSessionFiles operation.
StatusReason (string) –
A short description of the reason the export is in
FAILED
status.
LastUpdatedAt (datetime) –
A timestamp that indicates when this resource was last updated. Timestamps are expressed using in ISO8601 format, such as:
2022-12-27T22:29:40+00:00
(UTC).Location (string) –
The location where Amazon GameLift Streams is streaming your application from.
A location’s name. For example,
us-east-1
. For a complete list of locations that Amazon GameLift Streams supports, see the Regions and quotas section in the Amazon GameLift Streams Developer Guide .LogFileLocationUri (string) –
Access location for log files that your content generates during a stream session. These log files are uploaded to cloud storage location at the end of a stream session. The Amazon GameLift Streams application resource defines which log files to upload.
Protocol (string) –
The data transfer protocol in use with the stream session.
SessionLengthSeconds (integer) –
The length of time that Amazon GameLift Streams keeps the game session open.
SignalRequest (string) –
The WebRTC ICE offer string that a client generates to initiate a connection to the stream session.
SignalResponse (string) –
The WebRTC answer string that the stream server generates in response to the
SignalRequest
.Status (string) –
The current status of the stream session. A stream session can host clients when in
ACTIVE
status.StatusReason (string) –
A short description of the reason the stream session is in
ERROR
status.StreamGroupId (string) –
The unique identifier for the Amazon GameLift Streams stream group that is hosting the stream session.
UserId (string) –
An opaque, unique identifier for an end-user, defined by the developer.
WebSdkProtocolUrl (string) –
The URL of an S3 bucket that stores Amazon GameLift Streams WebSDK files. The URL is used to establish connection with the client.
Exceptions