Required Instance Methodswift-nio 2.72.0NIOHTTP1
buildUpgradeResponse(channel:upgradeRequest:initialResponseHeaders:)
Builds the upgrade response headers. Should return any headers that need to be supplied to the client in the 101 Switching Protocols response. If upgrade cannot proceed for any reason, this function should fail the future.
HTTPServerUpgradeHandler.swift:43func buildUpgradeResponse(channel: Channel, upgradeRequest: HTTPRequestHead, initialResponseHeaders: HTTPHeaders) -> EventLoopFuture<HTTPHeaders>
Other requirements
Instance members
var requiredUpgradeHeaders: [String]
All the header fields the protocol needs in the request to successfully upgrade. These header fields will be provided to the handler when it is asked to handle the upgrade. They will also be validated against the inbound request’s Connection header field.
var supportedProtocol: String
The protocol this upgrader knows how to support.
func upgrade(context: ChannelHandlerContext, upgradeRequest: HTTPRequestHead
) -> 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.