allocator
The Channel
’s ByteBuffer
allocator. This is the only supported way of allocating ByteBuffer
s to be used with this Channel
.
var allocator: ByteBufferAllocator { get }
The Channel
’s ByteBuffer
allocator. This is the only supported way of allocating ByteBuffer
s to be used with this Channel
.
var allocator: ByteBufferAllocator { get }
import NIOCore
The core abstractions that make up SwiftNIO.
protocol Channel : AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySendable
A Channel
is easiest thought of as a network socket. But it can be anything that is capable of I/O operations such as read, write, connect, and bind.
struct ByteBufferAllocator
The preferred allocator for ByteBuffer
values. The allocation strategy is opaque but is currently libc’s malloc
, realloc
and free
.
var _channelCore: ChannelCore { get }
Reach out to the _ChannelCore
.
var closeFuture: EventLoopFuture<Void> { get }
The closeFuture
will fire when the Channel
has been closed.
var isActive: Bool { get }
Returns if this Channel
is currently active. Active is defined as the period of time after the channelActive
and before channelInactive
has fired. The main use for this is to know if channelActive
or channelInactive
can be expected next when handlerAdded
was received.
var isWritable: Bool { get }
Returns if this Channel
is currently writable.
var localAddress: SocketAddress? { get }
The local SocketAddress
.
var parent: Channel? { get }
Channel
s are hierarchical and might have a parent Channel
. Channel
hierarchies are in use for certain protocols such as HTTP/2.
var pipeline: ChannelPipeline { get }
The ChannelPipeline
which handles all I/O events and requests associated with this Channel
.
var remoteAddress: SocketAddress? { get }
The remote peer’s SocketAddress
.
var syncOptions: NIOSynchronousChannelOptions? { get }
Returns a view of the Channel
exposing synchronous versions of setOption
and getOption
. The default implementation returns nil
, and Channel
implementations must opt in to support this behavior.
func getOption<Option>(_ option: Option) -> EventLoopFuture<Option.Value> where Option : ChannelOption
Get the value of option
for this Channel
.
func setOption<Option>(_ option: Option, value: Option.Value) -> EventLoopFuture<Void> where Option : ChannelOption
Set option
to value
on this Channel
.
@preconcurrency func write<T>(_ any: T) -> EventLoopFuture<Void> where T : Sendable
Write data into the Channel
, automatically wrapping with NIOAny
.
@preconcurrency func write<T>(_ any: T, promise: EventLoopPromise<Void>?) where T : Sendable
Write data into the Channel
, automatically wrapping with NIOAny
.
@preconcurrency func writeAndFlush<T>(_ any: T) -> EventLoopFuture<Void> where T : Sendable
Write and flush data into the Channel
, automatically wrapping with NIOAny
.
@preconcurrency func writeAndFlush<T>(_ any: T, promise: EventLoopPromise<Void>?) where T : Sendable
Write and flush data into the Channel
, automatically wrapping with NIOAny
.