WebSocketResultHandler<T> class
A reconnecting, Result-flavored wrapper around a WebSocketChannel.
Each frame from the server is parsed by MessageParser and emitted on
stream as Result<T>. Connection / parsing errors surface on the same
stream as Error<T> events, so consumers don't need an onError handler.
Constructors
-
WebSocketResultHandler({required WebSocketChannelFactory channelFactory, required MessageParser<
T> parser, ReconnectConfig reconnect = const ReconnectConfig()}) -
Creates a handler that opens its channel via
channelFactory.
Properties
Methods
-
close(
) → Future< void> - Closes the channel and stops reconnect attempts. Safe to call multiple times.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
dynamic data) → Result< void> -
Sends
datato the server. Returns Success when the data was handed to the underlying sink, or an Error if the channel is not connected. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited