channel
The underlying channel being wrapped by this NIOAsyncChannel
.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
let channel: Channel
The underlying channel being wrapped by this NIOAsyncChannel
.
let channel: Channel
import NIOCore
The core abstractions that make up SwiftNIO.
struct NIOAsyncChannel<Inbound, Outbound> where Inbound : Sendable, Outbound : Sendable
Wraps a NIO Channel
object into a form suitable for use in Swift Concurrency.
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.
init(wrappingChannelSynchronously channel: Channel, configuration: Configuration = .init()) throws
Initializes a new NIOAsyncChannel
wrapping a Channel
.
init(wrappingChannelSynchronously channel: Channel, configuration: Configuration = .init()) throws where Outbound == Never
Initializes a new NIOAsyncChannel
wrapping a Channel
where the outbound type is Never
.
static func _wrapAsyncChannelWithTransformations(wrappingChannelSynchronously channel: Channel, backPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark? = nil, isOutboundHalfClosureEnabled: Bool = false, channelReadTransformation: @escaping (Channel) -> EventLoopFuture<Inbound>) throws -> NIOAsyncChannel<Inbound, Outbound> where Outbound == Never
This method is only used from our server bootstrap to allow us to run the child channel initializer at the right moment.
func executeThenClose<Result>(_ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>, _ outbound: NIOAsyncChannelOutboundWriter<Outbound>) async throws -> Result) async throws -> Result
Provides scoped access to the inbound and outbound side of the underlying Channel
.
struct Configuration
init(synchronouslyWrapping channel: Channel, configuration: Configuration = .init()) throws
Initializes a new NIOAsyncChannel
wrapping a Channel
.
init(synchronouslyWrapping channel: Channel, configuration: Configuration = .init()) throws where Outbound == Never
Initializes a new NIOAsyncChannel
wrapping a Channel
where the outbound type is Never
.
static func _wrapAsyncChannelWithTransformations(synchronouslyWrapping channel: Channel, backPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark? = nil, isOutboundHalfClosureEnabled: Bool = false, channelReadTransformation: @escaping (Channel) -> EventLoopFuture<Inbound>) throws -> NIOAsyncChannel<Inbound, Outbound> where Outbound == Never
This method is only used from our server bootstrap to allow us to run the child channel initializer at the right moment.
var inbound: NIOAsyncChannelInboundStream<Inbound> { get }
The stream of inbound messages.
var outbound: NIOAsyncChannelOutboundWriter<Outbound> { get }
The writer for writing outbound messages.