Skip to content

Commit

Permalink
Add comment for nonNegotiatedExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Nov 18, 2024
1 parent f17c65d commit 65f72f4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Sources/WSCore/Extensions/WebSocketExtensionBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

0 comments on commit 65f72f4

Please sign in to comment.