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:

  1. Initialized - Initial state before any connection attempt
  2. Connecting - Attempting to establish WebSocket connection
  3. Authenticating - Connection established, authenticating with server
  4. Connected - Fully connected and authenticated
  5. Disconnecting - Gracefully closing the connection
  6. 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.
const
factory
WebSocketConnectionState.connected({required HealthCheckInfo healthCheck})
Creates a Connected connection state.
const
factory
WebSocketConnectionState.connecting()
Creates a Connecting connection state.
const
factory
WebSocketConnectionState.disconnected({required DisconnectionSource source})
Creates a Disconnected connection state.
const
factory
WebSocketConnectionState.disconnecting({required DisconnectionSource source})
Creates a Disconnecting connection state.
const
factory
WebSocketConnectionState.initialized()
Creates an Initialized connection state.
const
factory

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 connected state.
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, the toString method will be overridden to output this instance's props.
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