---
title: "handleIncomingRequest(_:)"
framework: xpc
role: symbol
role_heading: Instance Method
path: "xpc/xpcpeerhandler/handleincomingrequest(_:)"
---

# handleIncomingRequest(_:)

A closure that receives a message from a client and optionally provides a reply.

## Declaration

```swift
func handleIncomingRequest(_: Self.Input) -> Self.Output?
```

## Return Value

Return Value A response message, if any, to send back to the client; otherwise nil.

## Discussion

Discussion If the closure returns nil, you can still send use send(message:) to send an asynchronous reply after handling the message.

## See Also

### Receiving client messages

- [Input](xpc/xpcpeerhandler/input.md)
- [Output](xpc/xpcpeerhandler/output.md)
