Initializerswift-nio 2.72.0NIOHTTP1
init(upgraders:httpHandlers:upgradeCompletionHandler:)
Create a HTTPClientUpgradeHandler
.
convenience init(upgraders: [NIOHTTPClientProtocolUpgrader], httpHandlers: [RemovableChannelHandler], upgradeCompletionHandler: @escaping (ChannelHandlerContext) -> Void)
Parameters
- upgraders
All
HTTPClientProtocolUpgrader
objects that will add their upgrade request headers and handle the upgrade if there is a response for their protocol. They should be placed in order of the preference for the upgrade.- httpHandlers
All
RemovableChannelHandler
objects which will be removed from the pipeline once the upgrade response is sent. This is used to ensure that the pipeline will be in a clean state after the upgrade. It should include any handlers that are directly related to handling HTTP. At the very least this should include theHTTPEncoder
andHTTPDecoder
, but should also include any other handler that cannot tolerate receiving non-HTTP data.- upgradeCompletionHandler
A closure that will be fired when HTTP upgrade is complete.