write(_:)
Fires write
from the tail to the head.
func write(_ data: NIOAny) -> EventLoopFuture<Void>
This method should typically only be called by Channel
implementations directly.
Fires write
from the tail to the head.
func write(_ data: NIOAny) -> EventLoopFuture<Void>
s7NIOCore15ChannelPipelineC21SynchronousOperationsV5writeyAA15EventLoopFutureCyytGAA6NIOAnyVF
What are these?6KBSX
This method should typically only be called by Channel
implementations directly.
import NIOCore
The core abstractions that make up SwiftNIO.
struct SynchronousOperations
A view of a ChannelPipeline
which may be used to invoke synchronous operations.
final class ChannelPipeline
A list of ChannelHandler
s 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 ChannelHandler
s in a pipeline interact with each other.
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.
final class EventLoopFuture<Value>
Holder for a result that will be provided later.
typealias Void = ()
The return type of functions that don’t explicitly specify a return type, that is, an empty tuple ()
.
var eventLoop: EventLoop { get }
The EventLoop
of the Channel
this synchronous operations view corresponds to.
func addHandler(_ handler: ChannelHandler, name: String? = nil, position: ChannelPipeline.Position = .last) throws
Add a handler to the pipeline.
func addHandlers(_ handlers: ChannelHandler..., position: ChannelPipeline.Position = .last) throws
Add one or more handlers to the pipeline.
func addHandlers(_ handlers: [ChannelHandler], position: ChannelPipeline.Position = .last) throws
Add an array of handlers to the pipeline.
func bind(to address: SocketAddress, promise: EventLoopPromise<Void>?)
Fires bind
from the tail to the head.
func close(mode: CloseMode = .all, promise: EventLoopPromise<Void>?)
Fires close
from the tail to the head.
func connect(to address: SocketAddress, promise: EventLoopPromise<Void>?)
Fires connect
from the tail to the head.
func context(handler: ChannelHandler) throws -> ChannelHandlerContext
Returns the ChannelHandlerContext
for the given handler instance if it is in the ChannelPipeline
, if it exists.
func context<Handler>(handlerType: Handler.Type) throws -> ChannelHandlerContext where Handler : ChannelHandler
Returns the ChannelHandlerContext
for the handler of given type, if one exists.
func context(name: String) throws -> ChannelHandlerContext
Returns the ChannelHandlerContext
for the handler with the given name, if one exists.
func fireChannelActive()
Fires channelActive
from the head to the tail.
func fireChannelInactive()
Fires channelInactive
from the head to the tail.
func fireChannelRead(_ data: NIOAny)
Fires channelRead
from the head to the tail.
func fireChannelReadComplete()
Fires channelReadComplete
from the head to the tail.
func fireChannelRegistered()
Fires channelRegistered
from the head to the tail.
func fireChannelUnregistered()
Fires channelUnregistered
from the head to the tail.
func fireChannelWritabilityChanged()
Fires channelWritabilityChanged
from the head to the tail.
func fireErrorCaught(_ error: Error)
Fires errorCaught
from the head to the tail.
func fireUserInboundEventTriggered(_ event: Any)
Fires userInboundEventTriggered
from the head to the tail.
func flush()
Fires flush
from the tail to the head.
func handler<Handler>(type _: Handler.Type) throws -> Handler where Handler : ChannelHandler
Returns the ChannelHandler
of the given type from the ChannelPipeline
, if it exists.
func inboundBufferedBytes() -> Int
Retrieve total number of bytes buffered for inbound.
func inboundBufferedBytes(in context: ChannelHandlerContext) -> Int?
Retrieve the number of inbound bytes buffered in the ChannelHandler
associated with the given ChannelHandlerContext
.
func outboundBufferedBytes() -> Int
Retrieve the total number of bytes buffered for outbound.
func outboundBufferedBytes(in context: ChannelHandlerContext) -> Int?
Retrieve the number of outbound bytes buffered in the ChannelHandler
associated with the givenChannelHandlerContext
.
func read()
Fires read
from the tail to the head.
func register(promise: EventLoopPromise<Void>?)
Fires register
from the tail to the head.
func removeHandler(_ handler: RemovableChannelHandler) -> EventLoopFuture<Void>
Remove a ChannelHandler
from the ChannelPipeline
.
func removeHandler(_ handler: RemovableChannelHandler, promise: EventLoopPromise<Void>?)
Remove a ChannelHandler
from the ChannelPipeline
.
func removeHandler(context: ChannelHandlerContext) -> EventLoopFuture<Void>
Remove a ChannelHandler
from the ChannelPipeline
.
func removeHandler(context: ChannelHandlerContext, promise: EventLoopPromise<Void>?)
Remove a ChannelHandler
from the ChannelPipeline
.
func removeHandler(name: String) -> EventLoopFuture<Void>
Remove a ChannelHandler
from the ChannelPipeline
.
func removeHandler(name: String, promise: EventLoopPromise<Void>?)
Remove a ChannelHandler
from the ChannelPipeline
.
func triggerUserOutboundEvent(_ event: Any, promise: EventLoopPromise<Void>?)
Fires triggerUserOutboundEvent
from the tail to the head.
func write(_ data: NIOAny, promise: EventLoopPromise<Void>?)
Fires write
from the tail to the head.
func writeAndFlush(_ data: NIOAny) -> EventLoopFuture<Void>
Fires writeAndFlush
from the tail to the head.
func writeAndFlush(_ data: NIOAny, promise: EventLoopPromise<Void>?)
Fires writeAndFlush
from the tail to the head.