Table of Contents

Interface INetMiddleware

Namespace
Moongate.Network.Interfaces
Assembly
Moongate.Network.dll

Defines a middleware component that can inspect and transform incoming network payloads before they are dispatched as events.

public interface INetMiddleware

Methods

ProcessAsync(MoongateTCPClient?, ReadOnlyMemory<byte>, CancellationToken)

Processes a payload for a specific client.

ValueTask<ReadOnlyMemory<byte>> ProcessAsync(MoongateTCPClient? client, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)

Parameters

client MoongateTCPClient

Client associated with the payload, if available.

data ReadOnlyMemory<byte>

Incoming payload.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<ReadOnlyMemory<byte>>

The transformed payload. Return Empty to drop the payload.

ProcessSendAsync(MoongateTCPClient?, ReadOnlyMemory<byte>, CancellationToken)

Processes an outgoing payload before it is sent to the socket.

ValueTask<ReadOnlyMemory<byte>> ProcessSendAsync(MoongateTCPClient? client, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)

Parameters

client MoongateTCPClient

Client associated with the payload, if available.

data ReadOnlyMemory<byte>

Outgoing payload.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<ReadOnlyMemory<byte>>

The transformed payload. Return Empty to drop the payload.