Contents

chooseBestHostPlayer(completionHandler:)

Determines the best player in the game to act as the server for a client-server match.

Declaration

func chooseBestHostPlayer(completionHandler: @escaping  @Sendable (String?) -> Void)
func chooseBestHostPlayer() async -> String?

Parameters

  • completionHandler:

    The block that GameKit calls when it completes the request.

    The block receives the following parameter:

    playerID

    The player identifier for the player with the best estimated network performance, or nil if GameKit couldn’t find a best host player.

Discussion

Calling this method causes GameKit to attempt to estimate which player has the best overall network connection using a variety of metrics such as bandwidth, latency, and network reliability. Typically, you call this method when your game implements a client-server model on top of the match’s peer-to-peer connection.

See Also

Deprecated Methods and Properties