PubSubSubscribeOptions class

Bounds a PubSub subscription's history volume and live delivery rate.

Passed to PubSub.subscribe, these limit how much history is replayed on subscribe (oldMessageLimit), cap how fast live messages are delivered (newMessageLimit), and choose what happens to live messages arriving faster than they drain (realtimeOverflow).

Every value is optional. An out-of-range value, or maxQueue combined with PubSubRealtimeOverflow.drop, makes subscribe throw an ArgumentError before anything is sent — the same check iOS and Android make.

Example

room.pubSub.subscribe(
  "CHAT",
  onMessageReceived,
  options: PubSubSubscribeOptions(oldMessageLimit: 100, maxQueue: 70),
);

Constructors

PubSubSubscribeOptions({int? oldMessageLimit, PubSubRealtimeOverflow realtimeOverflow = PubSubRealtimeOverflow.queue, int? maxQueue, int? newMessageLimit})
Creates options for PubSub.subscribe.
const

Properties

maxQueue → int?
How far a subscriber may fall behind before the server gives up on it.
final
newMessageLimit → int?
Caps how many live messages this subscriber accepts per server batching window, to bound the delivery rate on a busy topic.
final
oldMessageLimit → int?
How many historical messages to replay on subscribe.
final
realtimeOverflow → PubSubRealtimeOverflow
What happens to live messages arriving faster than they drain.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited