MessageQueue class
Buffers outgoing messages while the connection is down.
When the connection is restored, call drain to retrieve all valid (non-expired) messages and send them in order.
Constructors
- MessageQueue({int maxSize = 100, Duration? messageTimeout})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
no setter
- isFull → bool
-
Returns
truewhen the queue has reached maxSize.no setter - isNotEmpty → bool
-
no setter
- length → int
-
no setter
- maxSize → int
-
final
- messageTimeout → Duration?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void -
drain(
) → List< QueuedMessage> - Removes and returns all non-expired messages. Expired messages are discarded.
-
enqueue(
WebSocketMessage message, {bool useAck = false}) → bool -
Adds
messageto the queue. Returnsfalseif the queue is full. -
getStats(
) → Map< String, dynamic> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
purgeExpired(
) → void - Removes messages that have exceeded their messageTimeout.
-
requeueFront(
QueuedMessage item) → void -
Re-inserts
itemat the front of the queue (used to requeue on send failure). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited