Skip to content

Commit e94f8c2

Browse files
committed
Reduce back to a single init
1 parent 092f039 commit e94f8c2

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

Sources/WSClient/WebSocketClientConfiguration.swift

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,6 @@ public struct WebSocketClientConfiguration: Sendable {
3232
/// Hostname used during TLS handshake
3333
public var sniHostname: String?
3434

35-
/// Initialize WebSocketClient configuration
36-
/// - Paramters
37-
/// - maxFrameSize: Max websocket frame size that can be sent/received
38-
/// - additionalHeaders: Additional headers to be sent with the initial HTTP request
39-
/// - extensions: WebSocket extensions
40-
/// - autoPing: Automatic Ping configuration
41-
/// - validateUTF8: Should text be checked to see if it is valid UTF8
42-
@_disfavoredOverload
43-
public init(
44-
maxFrameSize: Int = (1 << 14),
45-
additionalHeaders: HTTPFields = .init(),
46-
extensions: [WebSocketExtensionFactory] = [],
47-
closeTimeout: Duration = .seconds(15),
48-
autoPing: AutoPingSetup = .disabled,
49-
validateUTF8: Bool = false
50-
) {
51-
self.maxFrameSize = maxFrameSize
52-
self.additionalHeaders = additionalHeaders
53-
self.extensions = extensions.map { $0.build() }
54-
self.closeTimeout = closeTimeout
55-
self.autoPing = autoPing
56-
self.validateUTF8 = validateUTF8
57-
self.sniHostname = nil
58-
}
59-
6035
/// Initialize WebSocketClient configuration
6136
/// - Paramters
6237
/// - maxFrameSize: Max websocket frame size that can be sent/received
@@ -65,6 +40,7 @@ public struct WebSocketClientConfiguration: Sendable {
6540
/// - autoPing: Automatic Ping configuration
6641
/// - validateUTF8: Should text be checked to see if it is valid UTF8
6742
/// - sniHostname: Hostname used during TLS handshake
43+
@_disfavoredOverload
6844
public init(
6945
maxFrameSize: Int = (1 << 14),
7046
additionalHeaders: HTTPFields = .init(),
@@ -80,6 +56,6 @@ public struct WebSocketClientConfiguration: Sendable {
8056
self.closeTimeout = closeTimeout
8157
self.autoPing = autoPing
8258
self.validateUTF8 = validateUTF8
83-
self.sniHostname = sniHostname
59+
self.sniHostname = nil
8460
}
8561
}

0 commit comments

Comments
 (0)