SubscriptionsManager class
A class that can manage the topic subscription process.
Constructors
- SubscriptionsManager(IMqttConnectionHandler? connectionHandler, PublishingManager? publishingManager, EventBus? _clientEventBus)
- Creates a new instance of a SubscriptionsManager that uses the specified connection to manage subscriptions.
Properties
- connectionHandler ↔ IMqttConnectionHandler?
-
The connection handler that we use to subscribe to subscription
acknowledgements.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- messageIdentifierDispenser ↔ MessageIdentifierDispenser
-
Dispenser used for keeping track of subscription ids
getter/setter pair
- onSubscribed ↔ SubscribeCallback?
-
Subscribe and Unsubscribe callbacks
getter/setter pair
- onSubscribeFail ↔ SubscribeFailCallback?
-
Subscription failed callback
getter/setter pair
- onUnsubscribed ↔ UnsubscribeCallback?
-
Unsubscribed
getter/setter pair
-
pendingSubscriptions
↔ Map<
int, Subscription> -
A list of subscriptions that are pending acknowledgement, keyed
on the message identifier.
getter/setter pair
-
pendingUnsubscriptions
↔ Map<
int, Subscription> -
A list of unsubscribe requests waiting for an unsubscribe ack message.
Index is the message identifier of the unsubscribe message
getter/setter pair
- publishingManager ↔ PublishingManager?
-
Publishing manager used for passing on published messages to subscribers.
getter/setter pair
- resubscribeOnAutoReconnect ↔ bool
-
Re subscribe on auto reconnect.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subscriptionNotifier
→ Stream<
List< MqttReceivedMessage< >MqttMessage> > -
Subscription notifier
no setter
-
subscriptions
↔ Map<
int, Subscription> -
List of confirmed subscriptions, keyed on the message identifier..
getter/setter pair
Methods
-
closeSubscriptionNotifier(
) → void - Closes the subscription notifier
-
confirmSubscription(
MqttMessage? msg) → bool - Confirms a subscription has been made with the broker. Moves the subscription from pending to active if the subscription has not failed.
-
confirmUnsubscribe(
MqttMessage? msg) → bool - Cleans up after an unsubscribe acknowledge message is received from the broker returns true, always
-
createNewBatchSubscription(
List< BatchSubscription> subscriptions) → Subscription? - Creates a new batch subscription for the specified topic. If the subscription cannot be created null is returned.
-
createNewSubscription(
String topic, MqttQos? qos) → Subscription? - Creates a new single subscription for the specified topic. If the subscription cannot be created null is returned.
-
getSubscriptionsStatus(
String topic) → MqttSubscriptionStatus - Gets the current status of a subscription. For a batch subscription the topic is the topic of the first subscription in the batch.
-
getSubscriptionsStatusBySubscription(
Subscription sub) → MqttSubscriptionStatus - Gets the current status of a subscription from its Subscription.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
publishMessageReceived(
MessageReceived event) → void - Publish message received
-
registerBatchSubscription(
List< BatchSubscription> subscriptions) → Subscription? - Registers a new batch subscription with the subscription manager.
-
registerSubscription(
String topic, MqttQos qos) → Subscription? - Registers a new subscription with the subscription manager.
-
resubscribe(
) → void - Re subscribe. Unsubscribes all confirmed subscriptions and re subscribes them without sending unsubscribe messages to the broker.
-
toString(
) → String -
A string representation of this object.
inherited
-
tryGetExistingSubscription(
String topic) → Subscription? - Gets a view on the existing observable, if the subscription already exists.
-
unsubscribe(
String topic, {dynamic expectAcknowledge = false}) → void -
Unsubscribe from a topic.
Some brokers(AWS for instance) need to have each unsubscription acknowledged, use
the
expectAcknowledgeparameter for this, default is false. For a batch subscription the topic is the first topic in the batch. -
unsubscribeMulti(
List< MultiUnsubscription> subscriptionsList, {bool expectAcknowledge = false}) → void - Batch unsubscribes in a single UNSUBSCRIBE packet.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited