Skip to content

Interface IChannelBuilderService

Namespace: Void.Proxy.Api.Network.Channels
Assembly: Void.Proxy.Api.dll

Discovers a protocol-specific channel builder and creates player-facing and server-facing channels from it.

public interface IChannelBuilderService

Properties

IsFallbackBuilder

Gets whether discovery selected the generic fallback builder because no listener recognized the protocol.

bool IsFallbackBuilder { get; }

Property Value

bool

Methods

BuildPlayerChannelAsync(IPlayer, CancellationToken)

Builds the player-facing channel and prepends any initial bytes consumed during discovery.

ValueTask<INetworkChannel> BuildPlayerChannelAsync(IPlayer player, CancellationToken cancellationToken = default)

Parameters

player IPlayer

The player that owns the channel.

cancellationToken CancellationToken

A token used to cancel channel construction.

Returns

ValueTask<INetworkChannel>

The constructed player-facing channel.

Exceptions

InvalidOperationException

The built-in implementation has not completed builder discovery.

BuildServerChannelAsync(IPlayer, IServer, CancellationToken)

Connects to a destination server and builds its server-facing channel.

ValueTask<INetworkChannel> BuildServerChannelAsync(IPlayer player, IServer server, CancellationToken cancellationToken = default)

Parameters

player IPlayer

The player for whom the channel is being built.

server IServer

The destination server to connect to.

cancellationToken CancellationToken

A token used to cancel connection and channel construction.

Returns

ValueTask<INetworkChannel>

The constructed server-facing channel.

Exceptions

InvalidOperationException

The built-in implementation has not completed builder discovery.

SearchChannelBuilderAsync(IPlayer, CancellationToken)

Reads the player’s initial data and asks channel-discovery listeners to select a builder.

ValueTask SearchChannelBuilderAsync(IPlayer player, CancellationToken cancellationToken = default)

Parameters

player IPlayer

The player whose protocol and builder are being discovered.

cancellationToken CancellationToken

A token used to cancel initial network I/O and event processing.

Returns

ValueTask

A task that completes when discovery has selected either a listener-provided builder or a fallback.

Exceptions

EndOfStreamException

The built-in implementation cannot read initial handshake data from the player connection.