channelRead(context:data:)
HTTPServerUpgradeHandler.swift:109func channelRead(context: ChannelHandlerContext, data: NIOAny)
func channelRead(context: ChannelHandlerContext, data: NIOAny)
s8NIOHTTP124HTTPServerUpgradeHandlerC11channelRead7context4datay7NIOCore07ChannelD7ContextC_AG6NIOAnyVtF
What are these?4PP38
import NIOHTTP1
final class HTTPServerUpgradeHandler
A server-side channel handler that receives HTTP requests and optionally performs a HTTP-upgrade. Removes itself from the channel pipeline after the first inbound request on the connection, regardless of whether the upgrade succeeded or not.
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.
init(upgraders: [HTTPServerProtocolUpgrader], httpEncoder: HTTPResponseEncoder, extraHTTPHandlers: [RemovableChannelHandler], upgradeCompletionHandler: @escaping (ChannelHandlerContext) -> Void)
Create a HTTPServerUpgradeHandler
.
func removeHandler(context: ChannelHandlerContext, removalToken: ChannelHandlerContext.RemovalToken)
typealias InboundIn = HTTPServerRequestPart
typealias InboundOut = HTTPServerRequestPart
typealias OutboundOut = HTTPServerResponsePart