SocketConnectionMetrics class

Contains comprehensive metrics about the WebSocket connection health.

Constructors

SocketConnectionMetrics({int? intervalMs, int? averageIntervalMs, int? minIntervalMs, int? maxIntervalMs, int? jitterMs, int missedPings = 0, int totalPings = 0, SocketConnectionQuality quality = SocketConnectionQuality.disconnected, int? timestamp, int? lastPingTimestamp})
const

Properties

averageIntervalMs int?
Rolling average of ping intervals (milliseconds)
final
hashCode int
The hash code for this object.
no setterinherited
intervalMs int?
Time between the last two PING messages received (milliseconds)
final
jitterMs int?
Variation in ping intervals (standard deviation in milliseconds)
final
lastPingTimestamp int?
System time of the last received ping
final
maxIntervalMs int?
Maximum observed ping interval (milliseconds)
final
minIntervalMs int?
Minimum observed ping interval (milliseconds)
final
missedPings int
Count of expected pings that were not received within the expected interval plus tolerance
final
quality SocketConnectionQuality
Overall connection quality assessment
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp int
System time when these metrics were calculated
final
totalPings int
Total number of pings received
final

Methods

copyWith({int? intervalMs, int? averageIntervalMs, int? minIntervalMs, int? maxIntervalMs, int? jitterMs, int? missedPings, int? totalPings, SocketConnectionQuality? quality, int? timestamp, int? lastPingTimestamp}) SocketConnectionMetrics
Creates a copy of this metrics object with updated values
getSuccessRate() double
Calculates the percentage of successfully received pings. Returns success rate as a percentage (0-100), or 100 if no pings expected yet
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

calculateQuality(int? averageInterval, int? jitter) SocketConnectionQuality
Calculates connection quality based on available interval and jitter metrics. Handles cases where we don't have enough data yet during initial connection.