Type Method
connect(to:headers:configuration:on:onUpgrade:)
Establish a WebSocket connection.
@preconcurrency static func connect(to url: String, headers: HTTPHeaders = [:], configuration: WebSocketClient.Configuration = .init(), on eventLoopGroup: any EventLoopGroup, onUpgrade: @escaping @Sendable (WebSocket) -> ()) -> EventLoopFuture<Void>
Parameters
urlURL for the WebSocket server.
headersHeaders to send to the WebSocket server.
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 WebSocket server is established.