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
clientMoongateTCPClientClient associated with the payload, if available.
dataReadOnlyMemory<byte>Incoming payload.
cancellationTokenCancellationTokenCancellation 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
clientMoongateTCPClientClient associated with the payload, if available.
dataReadOnlyMemory<byte>Outgoing payload.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<ReadOnlyMemory<byte>>
The transformed payload. Return Empty to drop the payload.