<!--
{
  "availability" : [
    "iOS: 3.0.0 - 7.0.0",
    "iPadOS: 3.0.0 - 7.0.0",
    "macOS: 10.8.0 - 10.10.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKSessionDelegate/session(_:didReceiveConnectionRequestFromPeer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(pl)GKSessionDelegate(im)session:didReceiveConnectionRequestFromPeer:"
  },
  "title" : "session(_:didReceiveConnectionRequestFromPeer:)"
}
-->

# session(_:didReceiveConnectionRequestFromPeer:)

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

```
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

The delegate should call the session’s [`acceptConnection(fromPeer:)`](/documentation/GameKit/GKSession/acceptConnection(fromPeer:)) method if it wants to accept the connection or the [`denyConnection(fromPeer:)`](/documentation/GameKit/GKSession/denyConnection(fromPeer:)) method if it wants to refuse the connection.

> Important:
> If a ``doc://com.apple.gamekit/documentation/GameKit/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 ``doc://com.apple.gamekit/documentation/GameKit/GKPeerPickerController`` object to configure the session, your delegate must implement this method as described above.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)