start_stream_session
¶
start_stream_session(
identifier: Identifier,
protocol: Protocol,
signal_request: SignalRequest,
application_identifier: Identifier,
*,
config_overrides: Optional[GameLiftStreamsClientConfig] = None,
client_token: Optional[ClientToken] = None,
description: Optional[Description] = None,
user_id: Optional[UserId] = None,
locations: Optional[LocationList] = None,
connection_timeout_seconds: Optional[ConnectionTimeoutSeconds] = None,
session_length_seconds: Optional[SessionLengthSeconds] = None,
additional_launch_args: Optional[GameLaunchArgList] = None,
additional_environment_variables: Optional[EnvironmentVariables] = None,
performance_stats_configuration: Optional[PerformanceStatsConfiguration] = None,
role_arn: Optional[IamRoleArn] = None,
display_configuration: Optional[DisplayConfiguration] = None,
) -> StartStreamSessionOutput
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 that a stream group has allocated. The start stream session process works as follows:
-
Prerequisites:
-
You must have a stream group in
ACTIVEstatus -
You must have idle or on-demand capacity in a stream group in the location you want to stream from
-
You must have at least one application associated to the stream group (use AssociateApplications if needed)
-
-
Start stream request:
-
Your backend server calls StartStreamSession to initiate connection
-
Amazon GameLift Streams creates the stream session resource, assigns an Amazon Resource Name (ARN) value, and begins searching for available stream capacity to run the stream
-
Session transitions to
ACTIVATINGstatus
-
-
Placement completion:
-
If Amazon GameLift Streams is successful in finding capacity for the stream, the stream session status changes to
ACTIVEstatus and StartStreamSession returns stream connection information -
If Amazon GameLift Streams was not successful in finding capacity within the placement timeout period (defined according to the capacity type and platform type), the stream session status changes to
ERRORstatus and StartStreamSession returns aStatusReasonofplacementTimeout
-
-
Connection completion:
-
Provide the new connection information to the requesting client
-
Client must establish connection within
ConnectionTimeoutSeconds(specified in StartStreamSession parameters) -
Session terminates automatically if client fails to connect in time
-
For more information about the stream session lifecycle, see Stream sessions in the Amazon GameLift Streams Developer Guide.
Timeouts to be aware of that affect a stream session:
-
Placement timeout: The amount of time that Amazon GameLift Streams has to find capacity for a stream request. Placement timeout varies based on the capacity type used to fulfill your stream request:
-
Always-on capacity: 75 seconds
-
On-demand capacity:
-
Linux/Proton runtimes: 90 seconds
-
Windows runtime: 10 minutes
-
-
-
Connection timeout: The amount of time that Amazon GameLift Streams waits for a client to connect to a stream session in
ACTIVEstatus, or reconnect to a stream session inPENDING_CLIENT_RECONNECTIONstatus, the latter of which occurs when a client disconnects or loses connection from a stream session. If no client connects before the timeout, Amazon GameLift Streams terminates the stream session. This value is specified byConnectionTimeoutSecondsin theStartStreamSessionparameters. -
Maximum session length: A stream session will be terminated after this amount of time has elapsed since it started, regardless of any existing client connections. This value is specified by
SessionLengthSecondsin theStartStreamSessionparameters.
To start a new stream session, specify a stream group ID and application ID, along with the transport protocol and signal request to use with the stream session.
For stream groups that have multiple locations, provide a set of locations ordered by priority using a Locations parameter. Amazon GameLift Streams will start a single stream session in the next available location. An application must be finished replicating to a remote location before the remote location can host a stream.
To reconnect to a stream session after a client disconnects or loses connection, use CreateStreamSessionConnection.
Parameters:
-
client_token(Optional[ClientToken], default:None) –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.
-
description(Optional[Description], default:None) –A human-readable label for the stream session. You can update this value later.
-
identifier(Identifier) –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. Example ARN:
arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4. Example ID:sg-1AB2C3De4. -
protocol(Protocol) –The data transport protocol to use for the stream session.
-
signal_request(SignalRequest) –A WebRTC ICE offer string to use when initializing a WebRTC connection. Typically, the offer is a very long JSON string. Provide the string as a text value in quotes.
Amazon GameLift Streams also supports setting the field to "NO_CLIENT_CONNECTION". This will create a session without needing any browser request or Web SDK integration. The session starts up as usual and waits for a reconnection from a browser, which is accomplished using CreateStreamSessionConnection.
-
application_identifier(Identifier) –An Amazon Resource Name (ARN) or ID that uniquely identifies the application resource. Example ARN:
arn:aws:gameliftstreams:us-west-2:111122223333:application/a-9ZY8X7Wv6. Example ID:a-9ZY8X7Wv6. -
user_id(Optional[UserId], default:None) –An opaque, unique identifier for an end-user, defined by the developer.
-
locations(Optional[LocationList], default:None) –A list of locations, in order of priority, where you want Amazon GameLift Streams to start a stream from. For example,
us-east-1. 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.For a complete list of locations that Amazon GameLift Streams supports, refer to Regions, quotas, and limitations in the Amazon GameLift Streams Developer Guide.
-
connection_timeout_seconds(Optional[ConnectionTimeoutSeconds], default:None) –Length of time (in seconds) that Amazon GameLift Streams should wait for a client to connect or reconnect to the stream session. Applies to both connection and reconnection scenarios. This time span starts when the stream session reaches
ACTIVEstate. If no client connects before the timeout, Amazon GameLift Streams terminates the stream session. Default value is 120. -
session_length_seconds(Optional[SessionLengthSeconds], default:None) –The maximum duration of a session. Amazon GameLift Streams will automatically terminate a session after this amount of time has elapsed, regardless of any existing client connections. Default value is 43200 (12 hours).
-
additional_launch_args(Optional[GameLaunchArgList], default:None) –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.
AdditionalEnvironmentVariablesandAdditionalLaunchArgshave similar purposes.AdditionalEnvironmentVariablespasses data using environment variables; whileAdditionalLaunchArgspasses data using command-line arguments. -
additional_environment_variables(Optional[EnvironmentVariables], default:None) –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.
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.
AdditionalEnvironmentVariablesandAdditionalLaunchArgshave similar purposes.AdditionalEnvironmentVariablespasses data using environment variables; whileAdditionalLaunchArgspasses data using command-line arguments. -
performance_stats_configuration(Optional[PerformanceStatsConfiguration], default:None) –Configuration settings for sharing the stream session's performance stats with the client
-
role_arn(Optional[IamRoleArn], default:None) –The ARN of an AWS Identity and Access Management (IAM) role that Amazon GameLift Streams assumes on your behalf during the stream session. The role grants Amazon GameLift Streams permission to obtain temporary credentials for your application. The role's trust policy must allow the
gameliftstreams.amazonaws.comservice principal to assume it. The role name must start withGameLiftStreams-. -
display_configuration(Optional[DisplayConfiguration], default:None) –The configuration for the stream session's virtual monitor, including the resolution settings.
If not specified, Amazon GameLift Streams uses the default resolution of 1920 × 1080.
Raises:
-
AccessDeniedException–You don't have the required permissions to access this Amazon GameLift Streams resource. Correct the permissions before you try again.
-
ConflictException–The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.
-
InternalServerException–The service encountered an internal error and is unable to complete the request.
-
ResourceNotFoundException–The resource specified in the request was not found. Correct the request before you try again.
-
ThrottlingException–The request was denied due to request throttling. Retry the request after the suggested wait time.
-
ValidationException–One or more parameter values in the request fail to satisfy the specified constraints. Correct the invalid parameter values before retrying the request.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_gameliftstreams/_services/game_lift_streams.py
1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | |