Type Method
connect(scheme:host:port:path:query:headers:proxy:proxyPort:proxyHeaders:proxyConnectDeadline:configuration:on:onUpgrade:)
Establish a WebSocket connection via a proxy server.
@preconcurrency static func connect(scheme: String = "ws", host: String, port: Int = 80, path: String = "/", query: String? = nil, headers: HTTPHeaders = [:], proxy: String?, proxyPort: Int? = nil, proxyHeaders: HTTPHeaders = [:], proxyConnectDeadline: NIODeadline = NIODeadline.distantFuture, configuration: WebSocketClient.Configuration = .init(), on eventLoopGroup: any EventLoopGroup, onUpgrade: @escaping @Sendable (WebSocket) -> ()) -> EventLoopFuture<Void>
Parameters
schemeScheme component of the URI for the origin server.
hostHost component of the URI for the origin server.
portPort on which to connect to the origin server.
pathPath component of the URI for the origin server.
queryQuery component of the URI for the origin server.
headersHeaders to send to the origin server.
proxyHost component of the URI for the proxy server.
proxyPortPort on which to connect to the proxy server.
proxyHeadersHeaders to send to the proxy server.
proxyConnectDeadlineDeadline for establishing the proxy connection.
configurationConfiguration for the WebSocket client.
eventLoopGroupEvent loop group to be used by the WebSocket client.
onUpgradeAn escaping closure to be executed after the upgrade is completed by
NIOWebSocketClientUpgrader.
Return Value
A future which completes when the connection to the origin server is established.