File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
2
2
import Foundation
3
+ import WebSocketKit
4
+ import NIOCore
3
5
4
6
public final class ACClient {
5
7
@@ -37,11 +39,14 @@ public final class ACClient {
37
39
}
38
40
}
39
41
42
+ /// Default websocket implementation
40
43
public init ( stringURL: String ,
44
+ configuration: WebSocketClient . Configuration = . init( ) ,
45
+ coreCount: Int = System . coreCount,
41
46
headers: [ String : String ] ? = nil ,
42
47
options: ACClientOptions ? = nil
43
48
) {
44
- self . ws = WSS ( stringURL: stringURL)
49
+ self . ws = WSS ( stringURL: stringURL, configuration : configuration , coreCount : coreCount )
45
50
self . headers = headers
46
51
self . options = options ?? ACClientOptions ( )
47
52
setupWSCallbacks ( )
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ open class WSS: ACWebSocketProtocol {
18
18
19
19
public var url : URL
20
20
private var eventLoopGroup : EventLoopGroup
21
+ private var configuration : WebSocketClient . Configuration
21
22
var ws : WebSocket ?
22
23
23
- init ( stringURL: String , coreCount: Int = System . coreCount) {
24
+ init ( stringURL: String , configuration : WebSocketClient . Configuration = . init ( ) , coreCount: Int = System . coreCount) {
24
25
url = URL ( string: stringURL) !
25
26
eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: coreCount)
27
+ self . configuration = configuration
26
28
}
27
29
28
30
public var onConnected : ( ( _ headers: [ String : String ] ? ) -> Void ) ?
@@ -43,6 +45,7 @@ open class WSS: ACWebSocketProtocol {
43
45
44
46
WebSocket . connect ( to: url. absoluteString,
45
47
headers: httpHeaders,
48
+ configuration: configuration,
46
49
on: eventLoopGroup
47
50
) { ws in
48
51
self . ws = ws
You can’t perform that action at this time.
0 commit comments