configureCommonHTTPServerPipeline(connectionConfiguration:streamConfiguration:streamDelegate:h2ConnectionChannelConfigurator:configurator:)

Configures a ChannelPipeline to speak either HTTP/1.1 or HTTP/2 according to what can be negotiated with the client.

HTTP2PipelineHelpers.swift:402
func configureCommonHTTPServerPipeline(connectionConfiguration: NIOHTTP2Handler.ConnectionConfiguration, streamConfiguration: NIOHTTP2Handler.StreamConfiguration, streamDelegate: NIOHTTP2StreamDelegate? = nil, h2ConnectionChannelConfigurator: NIOChannelInitializer? = nil, configurator: @escaping NIOChannelInitializer) -> EventLoopFuture<Void>

Parameters

connectionConfiguration

The settings that will be used when establishing the HTTP/2 connection. These will be sent to the peer as part of the handshake.

streamConfiguration

The settings that will be used when establishing new HTTP/2 streams. These mainly pertain to flow control.

streamDelegate

The delegate to be notified in the event of stream creation and close.

h2ConnectionChannelConfigurator

An optional callback that will be invoked only when the negotiated protocol is H2 to configure the connection channel.

configurator

A callback that will be invoked after a protocol has been negotiated. The callback only needs to add application-specific handlers and must return a future that completes when the channel has been fully mutated.

Returns

EventLoopFuture<Void> that completes when the channel is ready.

This helper takes care of configuring the server pipeline such that it negotiates whether to use HTTP/1.1 or HTTP/2. Once the protocol to use for the channel has been negotiated, the provided callback will configure the application-specific handlers in a protocol-agnostic way.

This function doesn’t configure the TLS handler. Callers of this function need to add a TLS handler appropriately configured to perform protocol negotiation.