channelRead(context:data:)
NIOHTTPClientUpgradeHandler.swift:209func channelRead(context: ChannelHandlerContext, data: NIOAny)
func channelRead(context: ChannelHandlerContext, data: NIOAny)
s8NIOHTTP127NIOHTTPClientUpgradeHandlerC11channelRead7context4datay7NIOCore07ChannelD7ContextC_AG6NIOAnyVtF
What are these?9EWZ8
import NIOHTTP1
final class NIOHTTPClientUpgradeHandler
A client-side channel handler that sends a HTTP upgrade handshake request to perform a HTTP-upgrade. When the first HTTP request is sent, this handler will add all appropriate headers to perform an upgrade to the a protocol. It may add headers for a set of protocols in preference order. If the upgrade fails (i.e. response is not 101 Switching Protocols), this handler simply removes itself from the pipeline. If the upgrade is successful, it upgrades the pipeline to the new protocol.
final class ChannelHandlerContext
Every ChannelHandler
has – when added to a ChannelPipeline
– a corresponding ChannelHandlerContext
which is the way ChannelHandler
s can interact with other ChannelHandler
s in the pipeline.
struct NIOAny
NIOAny
is an opaque container for values of any type, similar to Swift’s builtin Any
type. Contrary to Any
the overhead of NIOAny
depends on the the type of the wrapped value. Certain types that are important for the performance of a SwiftNIO application like ByteBuffer
, FileRegion
and AddressEnvelope<ByteBuffer>
can be expected to be wrapped almost without overhead. All others will have similar performance as if they were passed as an Any
as NIOAny
just like Any
will contain them within an existential container.
convenience init(upgraders: [NIOHTTPClientProtocolUpgrader], httpHandlers: [RemovableChannelHandler], upgradeCompletionHandler: @escaping (ChannelHandlerContext) -> Void)
Create a HTTPClientUpgradeHandler
.
func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?)
typealias InboundIn = HTTPClientResponsePart
typealias InboundOut = HTTPClientResponsePart
typealias OutboundIn = HTTPClientRequestPart
typealias OutboundOut = HTTPClientRequestPart