Typealiases

The following typealiases are available globally.

  • The signature for the inactivity handler.

    Declaration

    Swift

    public typealias InactivityHandler = (_ connection: Connection) -> Void
  • Signature of a closure that is invoked to retrieve/create a connection object.

    Note

    The factory is responsible to retain the connection object. I.e. the factory should ensure that the connection object remains allocated until it is no longer needed (i.e. until the connection is closed).

    Declaration

    Swift

    public typealias ConnectionObjectFactory = (_ intf: InterfaceAccess, _ address: String) -> Connection?

    Parameters

    intf

    Provides acces to the underlying interface.

    address

    The IP address of the peer.

  • Signature of a closure that can be invoked immediately after a client has been accepted.

    Declaration

    Swift

    public typealias AddressHandler = (_ address: String) -> Bool

    Parameters

    address

    The address of the client.

    Return Value

    False to reject the client, True to continue nominally.

  • Signature of a closure that can be used as a progress indicator for lengthy transfers. It can also be used to abort a transfer.

    Note

    During the execution of the progress function the transfer will be temporary interrupted.

    Note

    After this operation returns ‘false’, there will be a second call of transmitProgress indicating that the transfer is complete (bytesTransferred is reduced to fit the amount transmitted) after which the transmit callback transmitReady is called.

    Declaration

    Swift

    public typealias TransmitterProgressMonitor = (_ bytesTransferred: Int, _ ofTotal: Int) -> Bool

    Parameters

    bytesTransferred

    The number of bytes transferred so far.

    ofTotal

    The total number of bytes to be transferred. Can be zero and may be reset to “bytesTransferred” if a previous execution of the closure returned ‘false’.

    Return Value

    True to continue the transfer. False to abort.

  • Signature for a closure that is used to process error messages.

    Declaration

    Swift

    public typealias ErrorHandler = (_ message: String) -> ()

    Parameters

    message

    Contains a textual description of the error.