TransportWsEventHandler<T> class
A class that handles events dispatched by the TransportWsClient.
Constructors
-
TransportWsEventHandler({T? connecting()?, T? opened(WebSocketChannel socket)?, T? connected(WebSocketChannel socket, Map<
String, Object?> ? payload)?, T? ping(Map<String, Object?> ? payload, {required bool received})?, T? pong(Map<String, Object?> ? payload, {required bool received})?, T? message(TransportWsMessage message)?, T? closed(Object event)?, T? error(Object event)?}) -
A class that handles events dispatched by the TransportWsClient.
const
Properties
- closed → (T? Function(Object event)?)
-
The argument is actually the websocket
CloseEvent
, but to avoid bundling DOM typings because the client can run in Node env too, you should assert the websocket type during implementation.final -
connected
→ (T? Function(WebSocketChannel socket, Map<
String, Object?> ? payload)?) -
The first argument is actually the
WebSocket
, but to avoid bundling DOM typings because the client can run in Node env too, you should assert the websocket type during implementation.final - connecting → (T? Function()?)
-
Executed when the client is staring a connection
final
- error → (T? Function(Object event)?)
-
Events dispatched from the WebSocket
onerror
are handled in this listener, as well as all internal client errors that could throw.final - hashCode → int
-
The hash code for this object.
no setterinherited
- message → (T? Function(TransportWsMessage message)?)
-
Called for all valid messages received by the client. Mainly useful for
debugging and logging received messages.
final
- opened → (T? Function(WebSocketChannel socket)?)
-
The first argument is actually the
WebSocket
, but to avoid bundling DOM typings because the client can run in Node env too, you should assert the websocket type during implementation.final -
ping
→ (T? Function(Map<
String, Object?> ? payload, {required bool received})?) -
The first argument communicates whether the ping was received from the server.
If
false
, the ping was sent by the client.final -
pong
→ (T? Function(Map<
String, Object?> ? payload, {required bool received})?) -
The first argument communicates whether the pong was received from the server.
If
false
, the pong was sent by the client.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
eventTypesHandled(
) → Set< TransportWsEventType> -
The
TransportWsEventType
s that this handler will handle. -
handle(
TransportWsEvent event) → T? -
Executes the handler for the given
event
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited