Skip to content

Commit

Permalink
allow socks proxy to be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dangelillo-pgatour committed May 31, 2022
1 parent c78e0b1 commit 0a75c61
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ public final class WebSocket: NSObject, WebSocketClient, StreamDelegate, WebSock
/// - Parameters:
/// - request: A URL request object that provides request-specific information such as the URL.
/// - protocol: Protocol to use for communication over the web socket.
public init(request: URLRequest, protocol: WSProtocol) {
public init(request: URLRequest, protocol: WSProtocol, enableSocksProxy: Bool = false) {
self.request = request
self.stream = FoundationStream()

if let stream = self.stream as? FoundationStream {
stream.enableSOCKSProxy = enableSocksProxy
}

if request.value(forHTTPHeaderField: Constants.headerOriginName) == nil {
guard let url = request.url else {return}
var origin = url.absoluteString
Expand Down

0 comments on commit 0a75c61

Please sign in to comment.