Contents

accept(incomingMessageHandler:cancellationHandler:)

Accepts an incoming session request from a client using closures to handle dictionary messages or cancellation, and returns the inactive session.

Declaration

@preconcurrency func accept(incomingMessageHandler: @escaping  @Sendable (XPCDictionary) -> XPCDictionary?, cancellationHandler: (@Sendable (XPCRichError) -> Void)? = nil) -> XPCListener.IncomingSessionRequest.Decision

Parameters

  • incomingMessageHandler:

    A closure that receives incoming messages from a client.

  • cancellationHandler:

    An optional closure that the system invokes when it cancels the session.

Return Value

A decision that indicates whether the listener accepts or rejects the incoming session.

Discussion

If you need to perform additional configuration on the session, use accept(incomingMessageHandler:cancellationHandler:) instead; that version returns a tuple that contains the session.

See Also

Responding to client sessions requests