Protocolswift-nio 2.72.0NIOHTTP1
NIOHTTPClientProtocolUpgrader
An object that implements NIOHTTPClientProtocolUpgrader
knows how to handle HTTP upgrade to a protocol on a client-side channel. It has the option of denying this upgrade based upon the server response.
protocol NIOHTTPClientProtocolUpgrader
Requirements
Instance members
var requiredUpgradeHeaders: [String]
All the header fields the protocol requires in the request to successfully upgrade. These header fields will be added to the outbound request’s “Connection” header field. It is the responsibility of the custom headers call to actually add these required headers.
var supportedProtocol: String
The protocol this upgrader knows how to support.
func addCustom(upgradeRequestHeaders: inout HTTPHeaders
) Additional headers to be added to the request, beyond the “Upgrade” and “Connection” headers.
func shouldAllowUpgrade(upgradeResponse: HTTPResponseHead
) -> Bool Gives the receiving upgrader the chance to deny the upgrade based on the upgrade HTTP response.
func upgrade(context: ChannelHandlerContext, upgradeResponse: HTTPResponseHead
) -> EventLoopFuture<Void> Called when the upgrade response has been flushed. At this time it is safe to mutate the channel pipeline to add whatever channel handlers are required. Until the returned
EventLoopFuture
succeeds, all received data will be buffered.