Skip to content

Commit 9871373

Browse files
committed
Add documentation for configureAsyncHTTP2Pipeline
1 parent 228e7bb commit 9871373

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Sources/NIOHTTP2/HTTP2PipelineHelpers.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,27 @@ extension ChannelPipeline.SynchronousOperations {
927927
)
928928
}
929929

930+
/// Configures a `ChannelPipeline` to speak HTTP/2 and sets up mapping functions so that it may be interacted with
931+
/// from concurrent code. This variant includes a ``NIOHTTP2ServerConnectionManagementHandler`` argument, and links
932+
/// its stream and frame delegates with ``NIOHTTP2Handler``.
933+
///
934+
/// This operation **must** be called on the event loop.
935+
///
936+
/// In general this is not entirely useful by itself, as HTTP/2 is a negotiated protocol. This helper does not
937+
/// handle negotiation. Instead, this simply adds the handler required to speak HTTP/2 after negotiation has
938+
/// completed, or when agreed by prior knowledge. Use this function to setup a HTTP/2 pipeline if you wish to use
939+
/// async sequence abstractions over inbound and outbound streams, as it allows that pipeline to evolve without
940+
/// breaking your code.
941+
///
942+
/// - Parameters:
943+
/// - mode: The mode this pipeline will operate in, server or client.
944+
/// - connectionManager: A ``NIOHTTP2ServerConnectionManagementHandler`` instance to use alongised the
945+
/// ``NIOHTTP2Handler``.
946+
/// - configuration: The settings that will be used when establishing the connection and new streams.
947+
/// - streamInitializer: A closure that will be called whenever the remote peer initiates a new stream.
948+
/// The output of this closure is the element type of the returned multiplexer
949+
/// - Returns: An `EventLoopFuture` containing the `AsyncStreamMultiplexer` inserted into this pipeline, which can
950+
/// be used to initiate new streams and iterate over inbound HTTP/2 stream channels.
930951
@inlinable
931952
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
932953
public func configureAsyncHTTP2Pipeline<Output: Sendable>(

0 commit comments

Comments
 (0)