DisconnectionSource class sealed
Represents the source or cause of a WebSocket disconnection.
A sealed class hierarchy that categorizes different reasons why a WebSocket connection was closed. The disconnection source determines whether automatic reconnection should be attempted and provides context for error handling.
Each source type provides specific information about the disconnection cause:
- UserInitiated: Explicit disconnection requested by the application
- ServerInitiated: Server closed the connection, possibly with an error
- SystemInitiated: System-level disconnection (network, app lifecycle)
- UnHealthyConnection: Connection closed due to failed health checks
Constructors
- DisconnectionSource.serverInitiated({WebSocketEngineException? error})
-
Creates a ServerInitiated disconnection source.
constfactory
- DisconnectionSource.systemInitiated()
-
Creates a SystemInitiated disconnection source.
constfactory
- DisconnectionSource.unHealthyConnection()
-
Creates an UnHealthyConnection disconnection source.
constfactory
- DisconnectionSource.userInitiated()
-
Creates a UserInitiated disconnection source.
constfactory
Properties
- closeReason → String
-
A human-readable description of the disconnection source.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
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
, thetoString
method 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