writeAndFlush(_:)
Write and flush 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) -> EventLoopFuture<Void> where T : Sendable s7NIOCore7ChannelP13writeAndFlushyAA15EventLoopFutureCyytGqd__lF What are these?7MYOUimport NIOCoreThe core abstractions that make up SwiftNIO.
protocol Channel : AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySendableA 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.
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 ().
protocol SendableA thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.
var _channelCore: any ChannelCore { get }Reach out to the _ChannelCore.
var allocator: ByteBufferAllocator { get }The Channel’s ByteBuffer allocator. This is the only supported way of allocating ByteBuffers to be used with this Channel.
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: (any Channel)? { get }Channels 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: (any 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, promise: EventLoopPromise<Void>?) where T : Sendable Write and flush 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.
@preconcurrency func writeAndFlush<T>(_ data: T) async throws where T : Sendable Shortcut for calling write and flush.