[NKP-0011] Extend subscription and unsubscribe

Current subscribe API is not friendly to reliable applications. Specifically:

  1. cannot subscribe indefinitely
  2. cannot extend existing subscription and has to wait for subscribe to expire before subscribe again
  3. cannot unsubscribe

1 and 2 will cause subscriber to miss a few blocks of subscription (and we’ve seen this cause troubles already in d-chat)

What I proposed:

  1. (Maybe) allow subscribe indefinitely
  2. Subscribe again before existing subscription expires will refresh (extend or shorten) existing subscription expiration
  3. Implement unsubscribe

I think we should allow at least one of 1 or 2 (3 is necessary IMO).

@insider @JohnSmith @lynn

  • Yes
  • No

0 voters

1 Like

To account for longer offline periods, if maximum subscription time was increased to something “crazy” like 99999 blocks, and extending subscriptions was possible, then there would be no infinite passengers left on the trains. At the same there should be no unwanted disconnects.

I fully support this NKP, unsubscribe certainly is a must. However I’m thinking, wouldn’t the indefinite subscription become a leak of some sort in the long run? A form of resubscribe functionality such as the one you describe in point 2, to me seems is the best middle-ground solution.

Since we don’t need to care about rollback now, extension and unsubscription is totally possible and easily doable.

However, I don’t think indefinite subscribtions is a good idea since they can’t be priced (in terms of fee) and won’t ever be recycled. I think current limit is about of ~2 weeks, should be enough time to extend.

2 weeks is definitely not enough. Imagine you are John McAfee, who need to be armed on a sail boat to do revolution and avoid authority, and also captured by aliens in between. 3 month to 1 year might be a reasonable upper limit.

3 Likes

Just to make it clear: the limit does not mean it cannot be extended. After we have extension it is able to extend subscription indefinitely (but each extension cannot exceed the limit)

you can track implementation here: https://github.com/nknorg/nkn/pull/609

you can track implementation here: https://github.com/nknorg/nkn/pull/609

thanks for this changes, i took a quick look and i think it will make the pubsub handling more convenient like this!