game / pragma.gameinstance / GameInstanceService / connectPlayersV1 /

connectPlayersV1 #

suspend fun connectPlayersV1(session: PartnerSession, request: GameInstanceRpc.ConnectPlayersV1Request): GameInstanceRpc.ConnectPlayersV1Response

Signals a game is ready to be joined by players. Invoked by the game server.

Each player receives a GameInstanceRpc.HostConnectionDetailsV1Notification containing all host connection details.

After notifying each player, this endpoint will optionally kick off two background tasks to track the game instance. The first is a keep alive heartbeat that will remove players from the game instance if a GameInstanceService.gameKeepAliveV1 request is not received in GameInstanceServiceConfig.keepAliveIntervalMillis after GameInstanceServiceConfig.keepAliveMissesLimit missed requests, and only if GameInstanceServiceConfig.enableKeepAlive is enabled. The other is an absolute game instance length timeout that will also remove players from the game instance if GameInstanceServiceConfig.absoluteTimeoutMillis elapses before a GameInstanceService.endGameV1 is received, only if GameInstanceServiceConfig.enableAbsoluteTimeout is enabled.

If additional players have been added to the game instance since the first GameStart data was provided, those players will be sent in batches to the game server after GameInstancePlugin.buildExtGameServerPlayer is invoked for each of them.

Plugins

  • GameInstancePlugin.buildExtGameServerPlayer - Provide ext data of each player to the game server before connecting the player.

PragmaResultErrors

  • PragmaError.GameInstanceService_UnknownGameInstanceId - If the game instance id from request is not found.
  • PragmaError.GameInstanceService_MissingPlayerConnectionDetails - If a PlayerConnectionDetails for an expected player was not present on the request.
  • PragmaError.GameInstanceService_InternalError - If a lock on the specified game instance could not be held.