Table of Contents

Class CompressorMiddleware

Namespace
IceRpc.Compressor
Assembly
IceRpc.Compressor.dll

Represents a middleware that decompresses the payloads of incoming requests and compresses the payloads of outgoing responses.

public class CompressorMiddleware : IDispatcher
Inheritance
CompressorMiddleware
Implements
Inherited Members

Remarks

This middleware decompresses the payload of an incoming request when the request carries a CompressionFormat field with a supported compression format (currently Brotli or Deflate).
This middleware compresses the payload of a response and sets the CompressionFormat field when the request has the ICompressFeature feature set and the response's CompressionFormat field is unset.

Constructors

CompressorMiddleware(IDispatcher, CompressionFormat, CompressionLevel)

Constructs a Compressor middleware.

public CompressorMiddleware(IDispatcher next, CompressionFormat compressionFormat, CompressionLevel compressionLevel = CompressionLevel.Fastest)

Parameters

next IDispatcher

The next dispatcher in the dispatch pipeline.

compressionFormat CompressionFormat

The compression format for the compress operation.

compressionLevel CompressionLevel

The compression level for the compress operation.

Methods

DispatchAsync(IncomingRequest, CancellationToken)

Dispatches an incoming request and returns the corresponding outgoing response.

public ValueTask<OutgoingResponse> DispatchAsync(IncomingRequest request, CancellationToken cancellationToken = default)

Parameters

request IncomingRequest

The incoming request being dispatched.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

ValueTask<OutgoingResponse>

The corresponding OutgoingResponse.

See Also