WSInterceptor class abstract interface

Interceptor for WebSocket messages. All methods should call next to continue the chain.

Hints:

  1. You can send a any type of data, and change its type to a string or a bytes array only at last Interceptor in chain. You can send a Map<String, dynamic> and change it to a string or attach a context to the message.

  2. You can log the message and use performance metrics inside Interceptor.

  3. You can call "next" once or multiple times or not call it at all to stop the chain.

Constructors

WSInterceptor.handlers({FutureOr<void> onSend(Object data, void next(Object data))?, FutureOr<void> onMessage(Object data, void next(Object data))?})
Create a WSInterceptor from a functions.
factory
WSInterceptor.wrap({FutureOr<void> onSend(Object data)?, FutureOr<void> onMessage(Object data)?})
Create a WSInterceptor from a functions.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMessage(Object data, void next(Object data)) → void
Called when the message is about to be received.
onSend(Object data, void next(Object data)) → void
Called when the message is about to be sent.
toString() String
A string representation of this object.
inherited

Operators

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