AckManager class

Tracks outgoing messages and waits for server ACK responses.

Outgoing messages receive an __ack_id__ injected into their metadata. The server must respond with {"__ack__": "<id>"} to acknowledge receipt. On timeout the message is retried up to maxRetries times before failing.

Constructors

AckManager({required Duration timeout, required int maxRetries, required Future<void> sender(WebSocketMessage message), required void log(String)})

Properties

hashCode int
The hash code for this object.
no setterinherited
maxRetries int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
final

Methods

dispose() → void
getStats() Map<String, dynamic>
handleIncomingMessage(WebSocketMessage message) bool
Call with every incoming message. Returns true if the message was an ACK (it should not be forwarded to the user in that case).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendWithAck(WebSocketMessage message) Future<void>
Sends message and returns a Future that completes when the server acknowledges it, or throws TimeoutException after retries are exhausted.
toString() String
A string representation of this object.
inherited

Operators

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