OutboundQueue class
A single FIFO for every outbound frame, with two admission lanes.
Constructors
-
OutboundQueue({required Future<
void> send(Uint8List bytes), bool isReady()?, bool canSend(Uint8List bytes)?, bool Function() createSendGuard(Uint8List bytes)?, bool Function() createDecodedSendGuard(String type, Map<String, Object?> payload)?, void onDropped(String type)?, Uint8List? substituteOnReject(String type, Uint8List bytes, String reason)?, int? maxPayloadBytes, int maxAttempts = 3, Duration backoffBase = const Duration(milliseconds: 200), int lossyCap = 32, int guaranteedCap = 64, Duration readyPoll = const Duration(milliseconds: 250), Future<void> sleep(Duration)?})
Properties
- backoffBase → Duration
-
final
- canSend → bool Function(Uint8List bytes)?
-
Rechecked at delivery time, including retries, so policy changes while
offline cannot release an old UI frame after reconnecting.
final
-
createDecodedSendGuard
→ bool Function() Function(String type, Map<
String, Object?> payload)? -
createSendGuard for producers that already hold the decoded frame
(see enqueue's
payload): the guard reads the map instead of decoding the bytes a second time. Takes precedence when a payload is supplied; otherwise createSendGuard (if any) is used.final - createSendGuard → bool Function() Function(Uint8List bytes)?
-
Called once at enqueue to freeze origin context for this frame. The
resulting guard is rechecked before every delivery attempt, alongside
canSend, so later frames cannot overwrite an older frame's identity.
final
- droppedGuaranteed ↔ int
-
Guaranteed frames lost to overflow or attempt exhaustion — should be 0 in
any healthy session; a nonzero value is a real signal.
getter/setter pair
- droppedLossy ↔ int
-
Lossy frames evicted or exhausted (Android
droppedFrames).getter/setter pair - guaranteedCap → int
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isReady → bool Function()?
-
Transport readiness (room Connected).
final
- lossyCap → int
-
final
- maxAttempts → int
-
final
- maxPayloadBytes → int?
-
Optional final transport guard for all frame types, measured on the
encoded bytes. Producers may trim/chunk beforehand; the queue only drops.
final
- onDropped → void Function(String type)?
-
Called with the frame
typewhen a frame is discarded under cap pressure, policy, or exhausted retries. A missing ui_diff and its queued dependents produce one notification to request a replacement baseline.final - readyPoll → Duration
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
send
→ Future<
void> Function(Uint8List bytes) -
Deliver one frame.
final
- substituteOnReject → Uint8List? Function(String type, Uint8List bytes, String reason)?
-
Asked when POLICY (not transport) rejects a guaranteed frame, at enqueue
size check or at delivery. A non-null result is delivered in its place,
without the policy guard — it must carry no screen content. This is how
a request/response frame the backend is waiting on (
info_query_response,find_candidates_response) becomes an explicit failure instead of a silent drop that leaves the agent waiting for a timeout.final
Methods
-
dispose(
) → void -
enqueue(
String type, Uint8List bytes, {Map< String, Object?> ? payload}) → void -
Enqueue by wire type.
payloadis the already-decoded frame when the producer has it — passed to createDecodedSendGuard so no frame is decoded more than once on its way out. -
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