Configuration
AsyncChannel.swift:37- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
struct Configuration
struct Configuration
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.
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.
let channel: Channel
The underlying channel being wrapped by this NIOAsyncChannel
.
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
.
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.
protocol Sendable
init(backPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark = .init(
lowWatermark: 2,
highWatermark: 10
), isOutboundHalfClosureEnabled: Bool = false, inboundType: Inbound.Type = Inbound.self, outboundType: Outbound.Type = Outbound.self)
Initializes a new Configuration
.
var backPressureStrategy: NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark
The back pressure strategy of the inbound
.
var inboundType: Inbound.Type
The inbound
message’s type.
var isOutboundHalfClosureEnabled: Bool
If outbound half closure should be enabled. Outbound half closure is triggered once the NIOAsyncChannelOutboundWriter
is either finished or deinitialized.
var outboundType: Outbound.Type
The outbound
message’s type.