Class AirshipTransferService

The transfer service allows you to move players between servers and create new servers.

Properties

onShutdown: Signal<void> = ...

Deprecated

Use Platform.Server.ServerManager.onShutdown instead.

transferPlayersOnShutdown: boolean = true

If true, players are automatically transfered into a new server when the server shuts down.

We try to transfer all players to the same server so they stay together.

Methods

  • Transfers a group of players to the provided game. A server in the default scene will be selected, or a new one will be created.

    Parameters

    • players: readonly (string | Player)[]

      The players to transfer, either userIds or Player objects

    • gameId: string

      The gameId to transfer the players to

    • Optional config: AirshipGameTransferConfig

      The configuration to be used for this transfer AirshipGameTransferConfig

    Returns Promise<TransferResult>

  • Transfers a group of players to a server that matches the provided configuration. If any of the configuration parameters are missing, they will be ignored when selecting a server.

    Parameters

    • players: readonly (string | Player)[]

      The players to transfer, either userIds or Player objects

    • selectors: AirshipMatchingServerTransferConfig

      The configuration for selecting a server. AirshipMatchingServerTransferConfig

    Returns Promise<TransferResult>

  • Transfers a group of players to another player. The target player must be in the current game.

    Parameters

    • players: (string | Player)[]

      The players to transfer, either userIds or Player objects

    • targetUserId: string

      The userId of the target player.

    • Optional config: AirshipPlayerTransferConfig

      The configuration for the transfer AirshipPlayerTransferConfig

    Returns Promise<TransferResult>

  • Transfers a group of players to the provided server. The target server must be part of the same game.

    Parameters

    • players: readonly (string | Player)[]
    • serverId: string

      The server to transfer the players to

    • Optional config: AirshipServerTransferConfig

      The configuration to be used for this transfer AirshipGameTransferConfig

    Returns Promise<TransferResult>

  • Transfers a player to the provided game. A server in the default scene will be selected, or a new one will be created.

    Parameters

    • player: string | Player

      The player to transfer, either userId or Player object

    • gameId: string

      The gameId to transfer the player to

    • Optional config: AirshipGameTransferConfig

      The configuration to be used for this transfer AirshipGameTransferConfig

    Returns Promise<TransferResult>

  • Transfers a player to a server that matches the provided configuration. If any of the configuration parameters are missing, they will be ignored when selecting a server.

    Parameters

    • player: string | Player
    • selectors: AirshipMatchingServerTransferConfig

      The configuration for selecting a server. AirshipMatchingServerTransferConfig

    Returns Promise<TransferResult>

  • Transfers a group of players to another player. The target player must be in the current game.

    Parameters

    • player: string | Player

      The player to transfer, either userId or Player object

    • targetUserId: string

      The userId of the target player.

    • Optional config: AirshipPlayerTransferConfig

      The configuration for the transfer AirshipPlayerTransferConfig

    Returns Promise<TransferResult>

  • Transfers a player to the provided server. The server can be in any scene, but must be part of the current servers game.

    Parameters

    • player: string | Player

      The player to transfer, either userIds or Player objects

    • serverId: string

      The server to transfer the player to

    • Optional config: AirshipServerTransferConfig

      The configuration to be used for this transfer AirshipGameTransferConfig

    Returns Promise<TransferResult>