---
title: "chooseBestHostingPlayer(completionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkmatch/choosebesthostingplayer(completionhandler:)"
---

# chooseBestHostingPlayer(completionHandler:)

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

## Declaration

```swift
func chooseBestHostingPlayer(completionHandler: @escaping @Sendable (GKPlayer?) -> Void)
```

```swift
func chooseBestHostingPlayer() async -> GKPlayer?
```

## Parameters

- `completionHandler`: The block that GameKit calls when it completes the request. The block receives the following parameter:

## Mentioned in

Exchanging data between players in real-time games

## Discussion

Discussion This method estimates which player has the best network connection using a variety of metrics such as bandwidth, latency, and network reliability. Use this method to choose the player that acts as the server when you implement a client-server topology on top of the match’s peer-to-peer connection.

## See Also

### Sending data to other players

- [send(_:to:dataMode:)](gamekit/gkmatch/send(_:to:datamode:).md)
- [sendData(toAllPlayers:with:)](gamekit/gkmatch/senddata(toallplayers:with:).md)
- [GKMatch.SendDataMode](gamekit/gkmatch/senddatamode.md)
