channelInitializer(_:)
Bootstrap.swift:885@preconcurrency func channelInitializer(_ handler: @escaping (Channel) -> EventLoopFuture<Void>) -> Self
@preconcurrency func channelInitializer(_ handler: @escaping (Channel) -> EventLoopFuture<Void>) -> Self
s8NIOPosix15ClientBootstrapC18channelInitializeryACXD7NIOCore15EventLoopFutureCyytGAE7Channel_pcF
What are these?6FDYL
import NIOPosix
final class ClientBootstrap
A ClientBootstrap
is an easy way to bootstrap a SocketChannel
when creating network clients.
protocol Channel : AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySendable
A Channel
is easiest thought of as a network socket. But it can be anything that is capable of I/O operations such as read, write, connect, and bind.
final class EventLoopFuture<Value>
Holder for a result that will be provided later.
typealias Void = ()
The return type of functions that don’t explicitly specify a return type, that is, an empty tuple ()
.
convenience init(group: EventLoopGroup)
Create a ClientBootstrap
on the EventLoopGroup
group
.
init?(validatingGroup group: EventLoopGroup)
Create a ClientBootstrap
on the EventLoopGroup
group
, validating that group
is compatible.
func bind(to address: SocketAddress) -> ClientBootstrap
Bind the SocketChannel
to address
.
func channelOption<Option>(_ option: Option, value: Option.Value) -> Self where Option : ChannelOption
func connect(host: String, port: Int) -> EventLoopFuture<Channel>
Specify the host
and port
to connect to for the TCP Channel
that will be established.
func connect<Output>(host: String, port: Int, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Specify the host
and port
to connect to for the TCP Channel
that will be established.
func connect(to address: VsockAddress) -> EventLoopFuture<Channel>
Specify the VSOCK address to connect to for the Channel
.
func connect(to address: SocketAddress) -> EventLoopFuture<Channel>
func connect<Output>(to address: SocketAddress, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Specify the address
to connect to for the TCP Channel
that will be established.
func connect<Output>(to address: VsockAddress, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Specify the VSOCK address to connect to for the Channel
.
func connect(unixDomainSocketPath: String) -> EventLoopFuture<Channel>
func connect<Output>(unixDomainSocketPath: String, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Specify the unixDomainSocket
path to connect to for the UDS Channel
that will be established.
func connectTimeout(_ timeout: TimeAmount) -> Self
Specifies a timeout to apply to a connection attempt.
func enableMPTCP(_ value: Bool) -> Self
Enables multi-path TCP support.
@preconcurrency func protocolHandlers(_ handlers: @escaping () -> [ChannelHandler]) -> Self
@preconcurrency func resolver(_ resolver: (Resolver & Sendable)?) -> Self
Specifies the Resolver
to use or nil
if the default should be used.
func withConnectedSocket(_ socket: NIOBSDSocket.Handle) -> EventLoopFuture<Channel>
Use the existing connected socket file descriptor.
func withConnectedSocket<Output>(_ socket: NIOBSDSocket.Handle, channelInitializer: @escaping (Channel) -> EventLoopFuture<Output>) async throws -> Output where Output : Sendable
Use the existing connected socket file descriptor.
func withConnectedSocket(descriptor: CInt) -> EventLoopFuture<Channel>
Use the existing connected socket file descriptor.