Static Methodswift-nio 2.72.0NIOWebSocket
randomRequestKey
Generates a random WebSocket Request Key by generating 16 bytes randomly using the SystemRandomNumberGenerator
and encoding them as a base64 string as defined in RFC6455 https://tools.ietf.org/html/rfc6455#section-4.1.
static func randomRequestKey() -> String
Returns
base64 encoded request key
Other members in extension
Type members
init(requestKey: String, maxFrameSize: Int, automaticErrorHandling: Bool, upgradePipelineHandler: @escaping (Channel, HTTPResponseHead) -> EventLoopFuture<Void>
) static func randomRequestKey<Generator>(using: inout Generator
) -> String Generates a random WebSocket Request Key by generating 16 bytes randomly and encoding them as a base64 string as defined in RFC6455 https://tools.ietf.org/html/rfc6455#section-4.1
Instance members
let requiredUpgradeHeaders: [String]
None of the websocket headers are actually defined as ‘required’.
let supportedProtocol: String
RFC 6455 specs this as the required entry in the Upgrade header.
func addCustom(upgradeRequestHeaders: inout HTTPHeaders
) Add additional headers that are needed for a WebSocket upgrade request.
func shouldAllowUpgrade(upgradeResponse: HTTPResponseHead
) -> Bool func upgrade(context: ChannelHandlerContext, upgradeResponse: HTTPResponseHead
) -> EventLoopFuture<Void>