markFailed
TypeScriptmarkFailed(error?: (NWError) | null): voidSwift declarationfinal func markFailed(error: NWError?)Mark the connection associated with the framer instance as failed (see NWConnection.State.failed).
class · iOS 13.0+ · SDK 27.1
final class InstanceNWProtocolFramer.Instance is an object that a custom framer protocol interacts with in order to drive connection state, parse input and output, and deliver and write data.
markFailed(error?: (NWError) | null): voidSwift declarationfinal func markFailed(error: NWError?)Mark the connection associated with the framer instance as failed (see NWConnection.State.failed).
get parameters(): (NWParameters) | nullSwift declarationfinal var parameters: NWParameters? { get }The parameters for the framer's connection
writeOutputData(data: ArrayBuffer): voidSwift declarationfinal func writeOutput(data: Data)Write arbitrary bytes as part of an outbound message. This is intended to be used for adding headers around application data, or writing any other data that is generated or transformed by the protocol instance. It does not pass along data directly from the application. This function may be called as part of any framer callback, not just handleOutput. - Parameter data: Arbitrary data to write on the connection.
writeOutputData25578(data: ArrayBuffer): voidSwift declarationfinal func writeOutput<Output>(data: Output) where Output : DataProtocolWrite arbitrary DataProtocol bytes as part of an outbound message. This is intended to be used for adding headers around application data, or writing any other data that is generated or transformed by the protocol instance. It does not pass along data directly from the application. This function may be called as part of any framer callback, not just handleOutput. - Parameter data: Arbitrary DataProtocol to write on the connection.
deliverInput(data: ArrayBuffer, message: NWProtocolFramer_Message, isComplete: boolean): voidSwift declarationfinal func deliverInput(data: Data, message: NWProtocolFramer.Message, isComplete: Bool)Deliver arbitrary data to the application. This is intended to deliver any data that is generated or transformed by the protocol instance. This function will incur a copy of bytes. - Parameter data: The bytes to deliver to the application. This must be non-nil. If an empty message needs to be delivered, use deliverInputNoCopy. - Parameter message: The message to associate with the received data. - Parameter isComplete: A boolean indicating whether or not this data represents the end of the message.
scheduleWakeup(wakeupTime: NWProtocolFramer_Instance_WakeupTime): voidSwift declarationfinal func scheduleWakeup(wakeupTime: NWProtocolFramer.Instance.WakeupTime)Schedule a wakeup on the framer instance for a number of milliseconds into the future. If this is called multiple times before the timeout is reached, the new value replaces the previous value. - Parameter wakeupTime: The number of milliseconds into the future at which to invoke the wakeup handler, or .forever, effectively unscheduling the timer.
get debugDescription(): stringSwift declarationfinal var debugDescription: String { get }A textual representation of this instance, suitable for debugging. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(reflecting:)` initializer. This initializer works with any type, and uses the custom `debugDescription` property for types that conform to `CustomDebugStringConvertible`: struct Point: CustomDebugStringConvertible { let x: Int, y: Int var debugDescription: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(reflecting: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `debugDescription` property.
passThroughInput(): voidSwift declarationfinal func passThroughInput()Mark the input side of the framer as a pass-through, which means the framer will not be notified of any further input data.
passThroughOutput(): voidSwift declarationfinal func passThroughOutput()Mark the output side of the framer as a pass-through, which means the framer will not be notified of any further output data.
writeOutputNoCopy(length: number): voidSwift declarationfinal func writeOutputNoCopy(length: Int) throwsWrite bytes directly from the application without any transformation or copy. The bytes will start at the current output cursor used for parsing and will implicitly advance the cursor by the length being written. This function must only be called from within the handleOutput function on NWProtocolFramerImplementation. Throws an error if not called within the context of handleOutput, or if the specified length is longer than the current message. - Parameter length: Number of bytes from application to write.
deliverInputNoCopy(length: number, message: NWProtocolFramer_Message, isComplete: boolean): booleanSwift declarationfinal func deliverInputNoCopy(length: Int, message: NWProtocolFramer.Message, isComplete: Bool) -> BoolDeliver bytes directly to the application without any transformation or copy. The bytes will start at the current input cursor used for parsing, and will implicitly advance the cursor by the length being delivered. - Parameter length: The number of input bytes to deliver. This will advance the parsing cursor by the specified number of bytes. To indicate the end of the message without delivering any data, a length of 0 may be passed along with isComplete. - Parameter message: The message to associate with the received data. - Parameter isComplete: A boolean indicating whether or not this data represents the end of the message. - Returns: `true` if the input was delivered immediately, or `false` if it will be delivered once more bytes become available.
prependApplicationProtocol(options: NWProtocolOptions): voidSwift declarationfinal func prependApplicationProtocol(options: NWProtocolOptions) throwsDynamically add a protocol to a connection establishment attempt "above" the framer protocol. This means that the protocol above will start running once the framer becomes ready by calling markReady(). This can only be used with framers that return a value of willMarkReady to their start handlers. An example of using this functionality is adding a security protocol, like TLS, above a framer once that framer completes its initial handshake. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to NWProtocolFramer.Instance.async(). Throws an error if the protocol could not be added. This will fail if the framer is already marked ready. - Parameter options: Protocol options for an application protocol to dynamically add "above" the framer.
prependApplicationProtocolIgnoringReady(options: NWProtocolOptions): voidSwift declarationfinal func prependApplicationProtocolIgnoringReady(options: NWProtocolOptions) throwsDynamically add a protocol to a connection establishment attempt "above" the framer protocol. This means that the protocol above will start running once the framer becomes ready by calling markReady(). This can only be used with framers that return a value of willMarkReady to their start handlers. An example of using this functionality is adding a security protocol, like TLS, above a framer once that framer completes its initial handshake. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to NWProtocolFramer.Instance.async(). Throws an error if the protocol could not be added. This function differs from prependApplicationProtocol when the framer has already been marked ready. prependApplicationProtocol will throw an error if the framer was marked ready. prependApplicationProtocolIgnoringReady will still add the protocol and reset ready. The framer must markReady again. If there is data in-flight on the connection, the behavior is undefined. - Parameter options: Protocol options for an application protocol to dynamically add "above" the framer.
async(execute: (() => void)): voidSwift declarationfinal func async(execute: @escaping () -> Void)Schedule a block asynchronously on the framer instance. This must be used anytime the caller wants to perform any other action on the framer instance while not directly in the callstack of a callback from the framer.
get local(): (NWEndpoint) | nullSwift declarationfinal var local: NWEndpoint? { get }The local endpoint for the framer's connection
get remote(): (NWEndpoint) | nullSwift declarationfinal var remote: NWEndpoint? { get }The remote endpoint for the framer's connection
get options(): NWProtocolFramer_OptionsSwift declarationfinal var options: NWProtocolFramer.Options { get }The options for the framer's connection
markReady(): voidSwift declarationfinal func markReady()Mark the connection associated with the framer instance as ready (see NWConnection.State.ready). This is intended to be used by protocols that require a handshake before being able to send application data. This should only be called if the return value to the start function was willMarkReady.
2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
NWProtocolFramer.Instance.parseInput(minimumIncompleteLength:maximumLength:parse:)
callback cannot propagate synchronous failure
NWProtocolFramer.Instance.parseOutput(minimumIncompleteLength:maximumLength:parse:)
callback cannot propagate synchronous failure