WebSocketManager class
Main manager class for WebSocket connections with reconnection and message queuing.
Constructors
- WebSocketManager.new({required WebSocketConfig config, ReconnectionStrategy? reconnectionStrategy, MessageQueue? messageQueue})
- Creates a new WebSocketManager.
Properties
- config → WebSocketConfig
-
The configuration for this manager.
final
-
connectionEventStream
→ Stream<
WebSocketEvent> -
Returns the stream of connection events.
no setter
- connectionState → WebSocketState
-
Returns the current connection state.
no setter
-
connectionStateStream
→ Stream<
WebSocketState> -
Returns the stream of connection state changes.
no setter
-
eventStream
→ Stream<
WebSocketManagerEvent> -
Returns the stream of manager events.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Returns true if the connection is active.
no setter
- isReconnecting → bool
-
Returns true if reconnection is in progress.
no setter
-
messageStream
→ Stream<
WebSocketMessage> -
Returns the stream of incoming messages.
no setter
-
queueStatistics
→ Map<
String, dynamic> -
Returns the message queue statistics.
no setter
- reconnectionAttempt → int
-
Returns the current reconnection attempt number.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateStream
→ Stream<
WebSocketManagerState> -
Returns the stream of manager state changes.
no setter
Methods
-
connect(
) → Future< void> - Connects to the WebSocket server.
-
disconnect(
) → Future< void> - Disconnects from the WebSocket server.
-
dispose(
) → Future< void> - Disposes of the manager and all resources.
-
getStatistics(
) → Map< String, dynamic> - Returns comprehensive statistics about the manager.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
WebSocketMessage message) → Future< bool> - Sends a message through the WebSocket connection. If the connection is not available, the message is queued.
-
sendBinary(
List< int> bytes) → Future<bool> - Sends a binary message.
-
sendJson(
Map< String, dynamic> json) → Future<bool> - Sends a JSON message.
-
sendPing(
) → Future< bool> - Sends a ping message.
-
sendPong(
) → Future< bool> - Sends a pong message.
-
sendText(
String text) → Future< bool> - Sends a text message.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited