diff --git a/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift b/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift index 591697592c..5921a3e25c 100644 --- a/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift +++ b/Sources/ApolloWebSocket/DefaultImplementation/WebSocket.swift @@ -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