MqttSubscriptionManager class
A class that manages the topic subscription process.
Constructors
- MqttSubscriptionManager(dynamic _connectionHandler, dynamic _clientEventBus)
- Creates a new instance of a SubscriptionsManager that uses the specified connection to manage subscriptions.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- messageIdentifierDispenser → MqttMessageIdentifierDispenser
-
Dispenser used for keeping track of subscription ids and generating
message identifiers.
no setter
- 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, List< MqttSubscription> > -
A list of subscriptions that are pending acknowledgement, keyed
on the message identifier.
no setter
-
pendingUnsubscriptions
→ Map<
int, List< MqttSubscription> > -
A list of unsubscribe requests waiting for an unsubscribe ack message.
Index is the message identifier of the unsubscribe message.
no setter
- 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?, MqttSubscription> -
List of confirmed subscriptions, keyed on the topic name.
no setter
Methods
-
confirmSubscription(
MqttMessage msg) → bool - Confirms a subscription has been made with the broker. Marks the subscription as confirmed. Returns true on successful subscription confirm, false on fail. Note if any subscriptions fail a fail will be returned.
-
confirmUnsubscribe(
MqttMessage msg) → bool - Confirms an unsubscription has been made with the broker. Removes the subscription. Returns true on successful unsubscription confirm, false on fail. The active subscription is not removed if the unsubscription for the topic fails.
-
getSubscriptionStatus(
MqttSubscription subscription) → MqttSubscriptionStatus - Gets the current status of a subscription.
-
getSubscriptionTopicStatus(
String topic) → MqttSubscriptionStatus - Gets the current status of a subscription topic.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
publishMessageReceived(
MqttMessageReceived event) → void - Publish message received
-
resubscribe(
) → void - Re subscribe. Unsubscribes all confirmed subscriptions and re subscribes them without sending unsubscribe messages to the broker.
-
subscribeSubscription(
MqttSubscription? subscription) → MqttSubscription? - Registers a new subscription with the subscription manager from a subscription. Returns the subscription subscribed to.
-
subscribeSubscriptionList(
List< MqttSubscription> ? subscriptions) → List<MqttSubscription> ? - Registers a new subscription with the subscription manager from a list of subscriptions. Note that user properties are set on a per message basis not a per subscription basis, if you wish to send user properties then set them on the first subscription in the list. Returns the actual subscriptions subscribed to or null if none.
-
subscribeSubscriptionTopic(
String? topic, MqttQos? qos) → MqttSubscription? - Registers a new subscription with the subscription manager from a topic and a maximum Qos. Returns the subscription subscribed to.
-
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribeSubscription(
MqttSubscription? subscription) → void - Unsubscribe from a subscription.
-
unsubscribeSubscriptionList(
List< MqttSubscription> ? subscriptions) → void - Unsubscribe from a subscription list. Note that user properties are set on a per message basis not a per subscription basis, if you wish to send user properties then set them on the first subscription in the list.
-
unsubscribeTopic(
String? topic) → void - Unsubscribe from a string topic.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited