WebSocketConnectionState class sealed
Represents the current state of a WebSocket connection.
A sealed class hierarchy that defines all possible states a WebSocket connection can be in during its lifecycle. Each state provides specific information about the connection status and determines available operations.
The connection progresses through states in this typical order:
- Initialized - Initial state before any connection attempt
- Connecting - Attempting to establish WebSocket connection
- Authenticating - Connection established, authenticating with server
- Connected - Fully connected and authenticated
- Disconnecting - Gracefully closing the connection
- Disconnected - Connection closed
States can transition directly to Disconnected from any other state in case of errors or unexpected disconnections.
Constructors
- WebSocketConnectionState.authenticating()
-
Creates an Authenticating connection state.
constfactory
- WebSocketConnectionState.connected({required HealthCheckInfo healthCheck})
-
Creates a Connected connection state.
constfactory
- WebSocketConnectionState.connecting()
-
Creates a Connecting connection state.
constfactory
- WebSocketConnectionState.disconnected({required DisconnectionSource source})
-
Creates a Disconnected connection state.
constfactory
- WebSocketConnectionState.disconnecting({required DisconnectionSource source})
-
Creates a Disconnecting connection state.
constfactory
- WebSocketConnectionState.initialized()
-
Creates an Initialized connection state.
constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Whether the connection state is currently active.
no setter
- isAutomaticReconnectionEnabled → bool
-
Whether automatic reconnection is enabled for this connection state.
no setter
- isConnected → bool
-
Whether the connection state is in
connectedstate.no setter -
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited
Methods
-
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