channelRead(context:data:)
ChannelHandler.swift:291func channelRead(context: ChannelHandlerContext, data: NIOAny)
func channelRead(context: ChannelHandlerContext, data: NIOAny)
s7NIOCore22_ChannelInboundHandlerPAAE11channelRead7context4datayAA0bD7ContextC_AA6NIOAnyVtF
What are these?6QLRN
import NIOCore
The core abstractions that make up SwiftNIO.
protocol _ChannelInboundHandler : ChannelHandler
Untyped ChannelHandler
which handles inbound I/O events.
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.
func channelRead(context: ChannelHandlerContext, data: NIOAny)
Called when some data has been read from the remote peer.
func channelActive(context: ChannelHandlerContext)
func channelInactive(context: ChannelHandlerContext)
func channelReadComplete(context: ChannelHandlerContext)
func channelRegistered(context: ChannelHandlerContext)
func channelUnregistered(context: ChannelHandlerContext)
func channelWritabilityChanged(context: ChannelHandlerContext)
func errorCaught(context: ChannelHandlerContext, error: Error)
func userInboundEventTriggered(context: ChannelHandlerContext, event: Any)