Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "index"

Index

Functions

acceptPlayerSession

  • acceptPlayerSession(playerSessionId: string): Promise<void>
  • Notify the GameLift service that a player with the specified player session ID has connected to the server process and needs validation.

    GameLift verifies that the player session ID is valid—that is, that the player ID has reserved a player slot in the game session. Once validated, GameLift changes the status of the player slot from RESERVED to ACTIVE.

    Parameters

    • playerSessionId: string

      Unique ID issued by the Amazon GameLift service in response to a call to the AWS SDK Amazon GameLift API action CreatePlayerSession. The game client references this ID when connecting to the server process.

    Returns Promise<void>

activateGameSession

  • activateGameSession(): Promise<void>
  • Notify the GameLift service that the server process has started a game session and is now ready to receive player connections.

    This action should be called as part of the onStartGameSession() callback function, after all game session initialization has been completed.

    Returns Promise<void>

describePlayerSessions

  • describePlayerSessions(request: DescribePlayerSessionsRequest): Promise<DescribePlayerSessionsResponse>
  • Retrieves player session data, including settings, session metadata, and player data.

    Use this action to get information for a single player session, for all player sessions in a game session, or for all player sessions associated with a single player ID.

    Parameters

    • request: DescribePlayerSessionsRequest

      Request that details what results to query on.

    Returns Promise<DescribePlayerSessionsResponse>

    Response object from the GameLift service.

getGameSessionId

  • getGameSessionId(): string
  • Retrieves a unique identifier for the game session currently being hosted by the server process, if the server process is active.

    The identifier is returned in ARN format: arn:aws:gamelift:<region>::gamesession/fleet-<fleet ID>/<ID string>.

    Returns string

    Current game session ID.

getInstanceCertificate

  • getInstanceCertificate(): Promise<GetInstanceCertificateResponse>
  • Retrieves the file location of a pem-encoded TLS certificate that is associated with the fleet and its instances.

    This certificate is generated when a new fleet is created with the certificate configuration set to GENERATED. Use this certificate to establish a secure connection with a game client and to encrypt client/server communication.

    Returns Promise<GetInstanceCertificateResponse>

    Object with the properties for setting up a TLS secured server.

getSdkVersion

  • getSdkVersion(): string
  • Returns the current version number of the SDK in use.

    Returns string

getTerminationTime

  • getTerminationTime(): number
  • Returns the time that a server process is scheduled to be shut down, if a termination time is available.

    A server process takes this action after receiving an onProcessTerminate() callback from the GameLift service. A server process may be shut down for several reasons: (1) process poor health, (2) when an instance is being terminated during a scale-down event, or (3) when an instance is being terminated due to a spot instance interruption.

    Returns number

initSdk

  • initSdk(): Promise<void>
  • Initializes the GameLift SDK.

    This method should be called on launch, before any other GameLift-related logic occurs.

    Returns Promise<void>

processEnding

  • processEnding(): Promise<void>
  • Notifies the GameLift service that the server process is shutting down.

    The application should exit with a 0 error code.

    Returns Promise<void>

processReady

  • Notifies the GameLift service that the server process is ready to host game sessions.

    This method should be called after successfully invoking initSdk() and completing any setup tasks required before the server process can host a game session.

    Parameters

    • processParameters: ProcessParameters

      Port number & function callbacks in response to GameLift events communicated to the application from the GameLift service.

    Returns Promise<void>

removePlayerSession

  • removePlayerSession(playerSessionId: string): Promise<void>
  • Notifies the GameLift service that a player with the specified player session ID has disconnected from the server process.

    In response, GameLift changes the player slot to available, which allows it to be assigned to a new player.

    Parameters

    • playerSessionId: string

      Identifier of the player session to remove/disassociate from the current game session.

    Returns Promise<void>

startMatchBackfill

  • startMatchBackfill(request: BackfillMatchmakingRequest): Promise<BackfillMatchmakingResponse>
  • Sends a request to find new players for open slots in a game session created with FlexMatch.

    See also the AWS SDK action StartMatchBackfill(). With this action, match backfill requests can be initiated by a game server process that is hosting the game session. Learn more about the FlexMatch backfill feature in Backfill Existing Games with FlexMatch.

    This action is asynchronous. If new players are successfully matched, the GameLift service delivers updated matchmaker data using the callback function onUpdateGameSession().

    Parameters

    • request: BackfillMatchmakingRequest

      BackfillMatchmakingRequest message that determines how/what gets backfilled with players. The message communicates the following information:

      • A ticket ID to assign to the backfill request. This information is optional; if no ID is provided, GameLift will autogenerate one.
      • The matchmaker to send the request to. The full configuration ARN is required. This value can be acquired from the game session's matchmaker data.
      • The ID of the game session that is being backfilled. This be found with getGameSessionId().
      • Available matchmaking data for the game session's current players.

    Returns Promise<BackfillMatchmakingResponse>

stopMatchBackfill

  • stopMatchBackfill(request: StopMatchmakingRequest): Promise<void>
  • Cancels an active match backfill request that was created with startMatchBackfill().

    See also the AWS SDK action [StopMatchmaking()]. Learn more about the FlexMatch backfill feature in [Backfill Existing Games with FlexMatch].

    Parameters

    Returns Promise<void>

terminateGameSession

  • terminateGameSession(): Promise<void>
  • Notifies the GameLift service that the server process has shut down the game session.

    Since each server process hosts only one game session at a time, there's no need to specify which session. This action should be called at the end of the game session shutdown process.

    After calling this action, the server process can call processReady() to signal its availability to host a new game session. Alternatively, it can call processEnding() to shut down the server process and terminate the instance.

    Returns Promise<void>

updatePlayerSessionCreationPolicy

  • updatePlayerSessionCreationPolicy(newPlayerSessionPolicy: "ACCEPT_ALL" | "DENY_ALL"): Promise<void>
  • Updates the current game session's ability to accept new player sessions. A game session can be set to either accept or deny all new player sessions. See also the AWS SDK action [UpdateGameSession()].

    Parameters

    • newPlayerSessionPolicy: "ACCEPT_ALL" | "DENY_ALL"

      String value indicating whether the game session accepts new players.

    Returns Promise<void>

Generated using TypeDoc