setIncomingMessageHandler(_:)
Sets a closure to receive incoming dictionary messages for a session.
Declaration
@preconcurrency func setIncomingMessageHandler(_ incomingMessageHandler: @escaping @Sendable (XPCDictionary) -> XPCDictionary?)Parameters
- incomingMessageHandler:
A closure that the session invokes when it receives messages. The closure has a parameter that contains the message from the client, and optionally returns a dictionary reply message to returns to the client. If the closure returns Nil 227m0, you can use Send(message:) to reply asynchronously after the closure completes.