<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -",
    "macOS: 14.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BrowserEngineKit",
  "identifier" : "/documentation/BrowserEngineKit/WebContentExtension/handle(xpcConnection:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "BrowserEngineKit"
    ],
    "preciseIdentifier" : "s:16BrowserEngineKit19WebContentExtensionP6handle13xpcConnectionySo03OS_H7_object_p_tF"
  },
  "title" : "handle(xpcConnection:)"
}
-->

# handle(xpcConnection:)

Accepts or rejects an incoming XPC connection.

```
func handle(xpcConnection: xpc_connection_t)
```

## Parameters

`xpcConnection`

The inbound connection.

## Discussion

When your browser app calls [`makeLibXPCConnection()`](/documentation/BrowserEngineKit/WebContentProcess/makeLibXPCConnection()), the framework calls this method on your extension, passing the newly created connection as the parameter.
To accept the connection, call <doc://com.apple.documentation/documentation/XPC/xpc_connection_set_event_handler(_:_:)> to install an event handler and listen for incoming messages.

Otherwise, call <doc://com.apple.documentation/documentation/XPC/xpc_connection_cancel(_:)> to reject the connection.

---

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)