configureCommonHTTPServerPipeline(h2ConnectionChannelConfigurator:targetWindowSize:_:)

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

HTTP2PipelineHelpers.swift:363
func configureCommonHTTPServerPipeline(h2ConnectionChannelConfigurator: NIOChannelInitializer? = nil, targetWindowSize: Int, _ configurator: @escaping NIOChannelInitializer) -> EventLoopFuture<Void>

Parameters

h2ConnectionChannelConfigurator

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

targetWindowSize

The target size of the HTTP/2 flow control window.

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.