Skip to content

Type Method

client(on:config:onUpgrade:)

Sets up a channel to operate as a WebSocket client.
@preconcurrency static func client(on channel: any Channel, config: WebSocket.Configuration, onUpgrade: @escaping @Sendable (WebSocket) -> ()) -> EventLoopFuture<Void>

Parameters

channel

NIO channel which the client/server will use to communicate.

config

Configuration for the client channel handlers.

onUpgrade

An escaping closure to be executed the channel is configured with the WebSocket handlers.

Return Value

A future which completes when the WebSocket connection to the server is established.