Skip to content

Interface INetworkChannel

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

Represents a network channel that manages a pipeline of instances.

public interface INetworkChannel : IDisposable, IAsyncDisposable

Implements

IDisposable, IAsyncDisposable

Properties

CanRead

Gets a value indicating whether the channel can read messages.

bool CanRead { get; }

Property Value

bool

CanWrite

Gets a value indicating whether the channel can write messages.

bool CanWrite { get; }

Property Value

bool

Head

Gets the first stream in the channel’s pipeline.

IMessageStreamBase Head { get; }

Property Value

IMessageStreamBase

IsAlive

Gets a value indicating whether the channel is active.

bool IsAlive { get; }

Property Value

bool

IsConfigured

Gets a value indicating whether the channel has been configured.

bool IsConfigured { get; }

Property Value

bool

IsPaused

Gets a value indicating whether the channel is currently paused.

bool IsPaused { get; }

Property Value

bool

IsPausedRead

Gets a value indicating whether read operations are currently paused.

bool IsPausedRead { get; }

Property Value

bool

IsPausedWrite

Gets a value indicating whether write operations are currently paused.

bool IsPausedWrite { get; }

Property Value

bool

Methods

Add<T>()

Adds a new stream of type T to the end of the pipeline.

void Add<T>() where T : class, IMessageStream, new()

Type Parameters

T

Add<T>(T)

Adds the specified stream to the end of the pipeline.

void Add<T>(T stream) where T : class, IMessageStream

Parameters

stream T

Type Parameters

T

AddBefore<TBefore, TValue>()

Inserts a new stream of type TValue before TBefore.

void AddBefore<TBefore, TValue>() where TBefore : class, IMessageStream where TValue : class, IMessageStream, new()

Type Parameters

TBefore

TValue

AddBefore<TBefore, TValue>(TValue)

Inserts the specified stream before TBefore.

void AddBefore<TBefore, TValue>(TValue stream) where TBefore : class, IMessageStream where TValue : class, IMessageStream

Parameters

stream TValue

Type Parameters

TBefore

TValue

Close()

Closes the channel and releases resources.

void Close()

Flush()

Flushes any buffered data.

void Flush()

FlushAsync(CancellationToken)

Asynchronously flushes any buffered data.

ValueTask FlushAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask

Get<T>()

Gets the stream of type T.

T Get<T>() where T : class, IMessageStreamBase

Returns

T

Type Parameters

T

Has<T>()

Determines whether a stream of type T exists in the pipeline.

bool Has<T>() where T : class, IMessageStreamBase

Returns

bool

Type Parameters

T

Pause(Operation)

Pauses channel operations.

void Pause(Operation operation = Operation.Read)

Parameters

operation Operation

PrependBuffer(Memory<byte>)

Inserts the given memory at the start of the buffer.

void PrependBuffer(Memory<byte> memory)

Parameters

memory Memory<byte>

ReadMessageAsync(CancellationToken)

Reads the next message from the channel.

ValueTask<INetworkMessage> ReadMessageAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<INetworkMessage>

Remove<T>()

Removes a stream of type T from the pipeline.

void Remove<T>() where T : class, IMessageStream

Type Parameters

T

Remove<T>(T)

Removes the specified stream from the pipeline.

void Remove<T>(T stream) where T : class, IMessageStream

Parameters

stream T

Type Parameters

T

Resume(Operation)

Resumes channel operations.

void Resume(Operation operation = Operation.Read)

Parameters

operation Operation

TryGet<T>(out T)

Attempts to retrieve a stream of type T.

bool TryGet<T>(out T result) where T : class, IMessageStreamBase

Parameters

result T

Returns

bool

Type Parameters

T

TryPause(Operation)

Attempts to pause channel operations.

bool TryPause(Operation operation = Operation.Read)

Parameters

operation Operation

Returns

bool

TryResume(Operation)

Attempts to resume channel operations.

bool TryResume(Operation operation = Operation.Read)

Parameters

operation Operation

Returns

bool

WriteMessageAsync(INetworkMessage, CancellationToken)

Writes the specified message to the channel.

ValueTask WriteMessageAsync(INetworkMessage message, CancellationToken cancellationToken = default)

Parameters

message INetworkMessage

cancellationToken CancellationToken

Returns

ValueTask