From 65f72f4379ae533c0a0c11207e0fb0bb62a4684d Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Mon, 18 Nov 2024 15:29:17 +0000 Subject: [PATCH] Add comment for nonNegotiatedExtension --- .../Extensions/WebSocketExtensionBuilder.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/WSCore/Extensions/WebSocketExtensionBuilder.swift b/Sources/WSCore/Extensions/WebSocketExtensionBuilder.swift index ad1d980..1cb6c9e 100644 --- a/Sources/WSCore/Extensions/WebSocketExtensionBuilder.swift +++ b/Sources/WSCore/Extensions/WebSocketExtensionBuilder.swift @@ -134,11 +134,18 @@ public struct WebSocketExtensionFactory: Sendable { self.build = build } - public static func nonNegotiatedExtension(_ _build: @escaping @Sendable () -> some WebSocketExtension) -> Self { + /// Extension to be applied without negotiation with the other side. + /// + /// Most extensions involve some form of negotiation between the client and the server + /// to decide on whether they should be applied and with what parameters. This extension + /// builder is for the situation where no negotiation is needed or that negotiation has + /// already occurred. + /// + /// - Parameter build: closure creating extension + /// - Returns: WebSocketExtensionFactory + public static func nonNegotiatedExtension(_ build: @escaping @Sendable () -> some WebSocketExtension) -> Self { return .init { - WebSocketNonNegotiableExtensionBuilder { - _build() - } + WebSocketNonNegotiableExtensionBuilder(build) } } }