CompressionInterceptor class

Interceptor that gzip-compresses outgoing messages above threshold bytes and transparently decompresses incoming compressed messages.

On web platforms compression is skipped (dart:io unavailable); messages pass through unmodified.

Wire format for compressed messages:

{"__c__": 1, "d": "<base64-encoded gzip data>"}
Inheritance

Constructors

CompressionInterceptor({int threshold = 1024})

Properties

hashCode int
The hash code for this object.
no setterinherited
isSupported bool
Whether compression is available on the current platform.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
threshold int
Minimum uncompressed byte length before compression is applied.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(dynamic error) Future
Called when a connection error occurs. Return null to suppress the error.
inherited
onReceive(WebSocketMessage message) Future<WebSocketMessage?>
Called after a message is received. Return null to drop the message.
override
onSend(WebSocketMessage message) Future<WebSocketMessage?>
Called before a message is sent. Return null to drop the message.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited