iotagent-node-lib icon indicating copy to clipboard operation
iotagent-node-lib copied to clipboard

Not possible to update a subscription

Open MichelSc opened this issue 4 years ago • 4 comments

I use version 2.16 of the iotagent-node-lib libary.

There are methods to adding a subscription (function subscribe(device, triggers, content, callback)) and for removing a subscription function unsubscribe(device, id, callback). These methods are OK.

But I need a method to update a subscription, implementing the http method PATCH /v2/subscriptions.

Workaround of doing first a subscribe and then an unsubscribe is not sufficient

  • registration id will change, so I will need to write more code (without much value)
  • notifications could be lost between the subscribe and the unsubscribe

MichelSc avatar Aug 20 '21 10:08 MichelSc

This issue about unsubscribe logic may be related: https://github.com/telefonicaid/iotagent-node-lib/issues/576

fgalan avatar Aug 26 '21 07:08 fgalan

To understand this better, from which point the new method would be called? In which use case it would be used?

fgalan avatar Aug 26 '21 07:08 fgalan

registration id will change

Do you mean subscription id?

fgalan avatar Aug 26 '21 10:08 fgalan

This is issue is not related to issue #576 (which is about the unsubscribe).

This issue requires to be able to update an existing subscription.

There is a typo in my issue description: I meant subscription id and not registration id, the id will change if we do a subscribe/unsubscribe.

This issue is related to issue #1086:

  • In my use case, I need different subscriptions for a same device
  • These subscriptions must be added and removed independently of each other.
  • If I could recognize the subscription in the notification handler, no problem, I would make different subscriptions for the same device
  • but I cannot, issue #1086!
  • so I merge the different subscriptions for the same device into 1 subscription
  • and then I need to update the 1 subscription for the device (this issue)

In my eyes, issue #1086 is more blocking than this issue.

MichelSc avatar Aug 26 '21 11:08 MichelSc