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?, String>
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<String, Subscription?>
List of confirmed subscriptions, keyed on the topic name.
getter/setter pair

Methods

confirmSubscription(MqttMessage? msg) bool
Confirms a subscription has been made with the broker. Marks the sub as confirmed in the subs storage. Returns true on successful subscription, false on fail.
confirmUnsubscribe(MqttMessage? msg) bool
Cleans up after an unsubscribe message is received from the broker. returns true, always
createNewSubscription(String topic, MqttQos? qos) Subscription?
Creates a new 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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publishMessageReceived(MessageReceived event) → void
Publish message received
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 un subscription acknowledged, use the expectAcknowledge parameter for this, default is false.

Operators

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