1.0.0 • Published 3 years ago

mqtt-subscription-vault v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

// save subscriptions in tree structure // expose add, remove, findMatch methods //set of subscriberNode subscriptions

//Example of subscription topic: // status/${accountId}/collections/+/things/+/actions/#

// onTopicAdded - callback called when new topic is added to vault // onTopicRemoved - callback called when old topics no longer have subscribers and are removed from vault // Used for subscribing to external client topics // Only called once per topic, even if there are multiple subscribers

/**

  • @class
  • @name SubscriptionVault
  • @classdesc Saves mqtt subscriptions in a tree structure by topic path.
  • Example of message topic:
  • status/myAccountId/collections/myCollection/things/myThingId/actions/myActionName
  • Exposes these methods: add, remove, findMatches, reset
  • @param {function} onTopicAdded - callback called when new topic is added to vault
  • @param {function} onTopicRemoved - callback called when old topics no longer have subscribers and are removed from vault
  • @example of subscriptionTree: { children: { status: { children: { myAccountId: { children: { collections: { children: { '#': { subscriptions: callbackRef } } } } } } } } } */