---
title: "setHostedPlayer(_:didConnect:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkmatchmakerviewcontroller/sethostedplayer(_:didconnect:)"
---

# setHostedPlayer(_:didConnect:)

Updates the connection status of a player in a hosted game.

## Declaration

```swift
func setHostedPlayer(_ player: GKPlayer, didConnect connected: Bool)
```

## Parameters

- `player`: The player whose status changed.
- `connected`: A Boolean value that indicates whether the player connected or disconnected from the hosted match.

## Mentioned in

Finding players for custom server-based games

## Discussion

Discussion When you connect or disconnect a player from your server in a hosted game, use this method to update the player’s status that appears in the matchmaker view controllers on other player’s devices. For example, invoke this method after you connect a player from the matchmakerViewController(_:hostedPlayerDidAccept:) delegate method.

## See Also

### Hosting matches

- [isHosted](gamekit/gkmatchmakerviewcontroller/ishosted.md)
