GameLiftStreams / Client / create_stream_session_connection

create_stream_session_connection

GameLiftStreams.Client.create_stream_session_connection(**kwargs)

Enables clients to reconnect to a stream session while preserving all session state and data in the disconnected session. This reconnection process can be initiated when a stream session is in either PENDING_CLIENT_RECONNECTION or ACTIVE status. The process works as follows:

  • Initial disconnect:

    • When a client disconnects or loses connection, the stream session transitions from CONNECTED to PENDING_CLIENT_RECONNECTION

  • Reconnection time window:

    • Clients have ConnectionTimeoutSeconds (defined in StartStreamSession) to reconnect before session termination

    • Your backend server must call CreateStreamSessionConnection to initiate reconnection

    • Session transitions to RECONNECTING status

  • Reconnection completion:

    • On successful CreateStreamSessionConnection, session status changes to ACTIVE

    • Provide the new connection information to the requesting client

    • Client must establish connection within ConnectionTimeoutSeconds

    • 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.

To begin re-connecting to an existing stream session, specify the stream group ID and stream session ID that you want to reconnect to, and the signal request to use with the stream.

See also: AWS API Documentation

Request Syntax

response = client.create_stream_session_connection(
    ClientToken='string',
    Identifier='string',
    StreamSessionIdentifier='string',
    SignalRequest='string'
)
Parameters:
  • 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.

  • Identifier (string) –

    [REQUIRED]

    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.

    The stream group that you want to run this stream session with. The stream group must be in ACTIVE status.

  • StreamSessionIdentifier (string) –

    [REQUIRED]

    Amazon Resource Name (ARN) or ID that uniquely identifies the stream session resource. Example ARN: arn:aws:gameliftstreams:us-west-2:111122223333:streamsession/sg-1AB2C3De4/ABC123def4567. Example ID: ABC123def4567.

    The stream session must be in PENDING_CLIENT_RECONNECTION or ACTIVE status.

  • 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. The offer must be newly generated, not the same offer provided to StartStreamSession.

Return type:

dict

Returns:

Response Syntax

{
    'SignalResponse': 'string'
}

Response Structure

  • (dict) –

    • SignalResponse (string) –

      The WebRTC answer string that the stream server generates in response to the SignalRequest.

Exceptions

  • GameLiftStreams.Client.exceptions.AccessDeniedException

  • GameLiftStreams.Client.exceptions.ResourceNotFoundException

  • GameLiftStreams.Client.exceptions.ThrottlingException

  • GameLiftStreams.Client.exceptions.InternalServerException

  • GameLiftStreams.Client.exceptions.ConflictException

  • GameLiftStreams.Client.exceptions.ValidationException