pipeline
ChannelPipeline.swift:1797let pipeline: ChannelPipelinelet pipeline: ChannelPipelines7NIOCore21ChannelHandlerContextC8pipelineAA0B8PipelineCvp What are these?85GI6import NIOCoreThe core abstractions that make up SwiftNIO.
final class ChannelHandlerContextEvery ChannelHandler has – when added to a ChannelPipeline – a corresponding ChannelHandlerContext which is the way ChannelHandlers can interact with other ChannelHandlers in the pipeline.
final class ChannelPipelineA list of ChannelHandlers that handle or intercept inbound events and outbound operations of a Channel. ChannelPipeline implements an advanced form of the Intercepting Filter pattern to give a user full control over how an event is handled and how the ChannelHandlers in a pipeline interact with each other.
var channel: any Channel { get }var eventLoop: any EventLoop { get }var handler: any ChannelHandler { get }var localAddress: SocketAddress? { get }var loopBound: NIOLoopBound<ChannelHandlerContext> { get }Returns this ChannelHandlerContext as a NIOLoopBound, bound to self.eventLoop.
let name: Stringvar remoteAddress: SocketAddress? { get }func bind(to address: SocketAddress, promise: EventLoopPromise<Void>?) Send a bind event to the next outbound ChannelHandler in the ChannelPipeline. When the bind event reaches the HeadChannelHandler a ServerSocketChannel will be bound.
func close(mode: CloseMode = .all, promise: EventLoopPromise<Void>?) Send a close event to the next outbound ChannelHandler in the ChannelPipeline. When the close event reaches the HeadChannelHandler the socket will be closed.
func connect(to address: SocketAddress, promise: EventLoopPromise<Void>?) Send a connect event to the next outbound ChannelHandler in the ChannelPipeline. When the connect event reaches the HeadChannelHandler a SocketChannel will be connected.
func fireChannelActive() Send a channelActive event to the next (inbound) ChannelHandler in the ChannelPipeline.
func fireChannelInactive() Send a channelInactive event to the next (inbound) ChannelHandler in the ChannelPipeline.
func fireChannelRead(_ data: NIOAny) Send data to the next inbound ChannelHandler. The data should be of type ChannelInboundHandler.InboundOut.
func fireChannelReadComplete() Signal to the next ChannelHandler that a read burst has finished.
func fireChannelRegistered() Send a channelRegistered event to the next (inbound) ChannelHandler in the ChannelPipeline.
func fireChannelUnregistered() Send a channelUnregistered event to the next (inbound) ChannelHandler in the ChannelPipeline.
func fireChannelWritabilityChanged() Send a writabilityChanged event to the next (inbound) ChannelHandler in the ChannelPipeline.
func fireErrorCaught(_ error: any Error) Send an error to the next inbound ChannelHandler.
func fireUserInboundEventTriggered(_ event: Any) Send a user event to the next inbound ChannelHandler from on the event loop.
func flush() Send a flush event to the next outbound ChannelHandler in the ChannelPipeline. When the flush event reaches the HeadChannelHandler the data previously enqueued will be attempted to be written to the socket.
func leavePipeline(removalToken: ChannelHandlerContext.RemovalToken) Synchronously remove the ChannelHandler with the given ChannelHandlerContext.
func read() Send a read event to the next outbound ChannelHandler in the ChannelPipeline. When the read event reaches the HeadChannelHandler the interest to read data will be signalled to the Selector. This will subsequently – when data becomes readable – cause channelRead events containing the data being sent through the ChannelPipeline.
func register(promise: EventLoopPromise<Void>?) Send a register event to the next (outbound) ChannelHandler in the ChannelPipeline.
func triggerUserOutboundEvent(_ event: Any, promise: EventLoopPromise<Void>?) Send a user event to the next outbound ChannelHandler in the ChannelPipeline.
func write(_ data: NIOAny, file: StaticString = #fileID, line: UInt = #line) -> EventLoopFuture<Void> Write data to the remote peer.
func write(_ data: NIOAny, promise: EventLoopPromise<Void>?) Send a write event to the next outbound ChannelHandler in the ChannelPipeline. When the write event reaches the HeadChannelHandler the data will be enqueued to be written on the next flush event.
func writeAndFlush(_ data: NIOAny, file: StaticString = #fileID, line: UInt = #line) -> EventLoopFuture<Void> Shortcut for calling write and flush.
func writeAndFlush(_ data: NIOAny, promise: EventLoopPromise<Void>?) Send a write event followed by a flush event to the next outbound ChannelHandler in the ChannelPipeline. When the write event reaches the HeadChannelHandler the data will be enqueued to be written when the flush also reaches the HeadChannelHandler.
struct RemovalTokenA RemovalToken is handed to a RemovableChannelHandler when its removeHandler function is invoked. A RemovableChannelHandler is then required to remove itself from the ChannelPipeline. The removal process is finalized by handing the RemovalToken to the ChannelHandlerContext.leavePipeline function.
func fireUserInboundEventTriggered(_ event: any Sendable) Send a user event to the next inbound ChannelHandler.
func triggerUserOutboundEvent(_ event: any Sendable, promise: EventLoopPromise<Void>?) Send a user event to the next outbound ChannelHandler in the ChannelPipeline.