---
title: "session(_:didReceiveConnectionRequestFromPeer:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gksessiondelegate/session(_:didreceiveconnectionrequestfrompeer:)"
---

# session(_:didReceiveConnectionRequestFromPeer:)

Received by the delegate when a remote peer wants to create a connection to the session.

## Declaration

```swift
optional func session(_ session: GKSession, didReceiveConnectionRequestFromPeer peerID: String)
```

## Parameters

- `session`: The session that received the request.
- `peerID`: A string that uniquely identifies the peer.

## Discussion

Discussion The delegate should call the session’s acceptConnection(fromPeer:) method if it wants to accept the connection or the denyConnection(fromPeer:) method if it wants to refuse the connection. important: If a GKPeerPickerController object is being used to configure the session, the controller handles this message automatically. Your delegate can ignore it if the peer picker dialog is in use. If your application is not using a GKPeerPickerController object to configure the session, your delegate must implement this method as described above.
