Contents

setIncomingMessageHandler(_:)

Sets a closure to receive incoming received messages for a session.

Declaration

@preconcurrency func setIncomingMessageHandler(_ incomingMessageHandler: @escaping  @Sendable (XPCReceivedMessage) -> (any Encodable)?)

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 an encodable 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.

Discussion

See Also

Managing the life cycle