Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use decoder as a seed for subscription #2034

Open
weboko opened this issue Jun 5, 2024 · 2 comments
Open

feat: use decoder as a seed for subscription #2034

weboko opened this issue Jun 5, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@weboko
Copy link
Collaborator

weboko commented Jun 5, 2024

This is a feature request

Problem

From #2022 it seems that Filter API is hard-to-understand right now as it makes us do:

const { error, subscription } = await node.filter.createSubscription(shardInfoOrPubsubTopic);
await subscription.subscribe([decoder], callback);

Proposed Solutions

Based on the fact that decoder is a primitive we use always in pair with Filter and it has knowledge on the pubsubTopic/contentTopic etc - we should use it.

const { error, subscription } = await node.filter.createSubscription(decoder);
await subscription.subscribe(callback);
// or instead of createSubscription we can use subscribe API
const { error, subscription } = await node.filter.subscribe(decoder, callback);
await subscription.subscribe(callback);

Also it doesn't seems to be used with many of other decoders and since one of the requirements is to have all decoders that are provided to use the same pubsubTopic - in that case we can just have one subscription per.

Notes

Additional context - #1981

@weboko weboko added the enhancement New feature or request label Jun 5, 2024
@weboko
Copy link
Collaborator Author

weboko commented Jun 5, 2024

@waku-org/js-waku-developers what do you think about this approach?

As a tradeoff to continue support multiple decoders - we can enable both:

  • await subscription.subscribe(callback);
  • await subscription.subscribe(decoder1, callback);

@weboko
Copy link
Collaborator Author

weboko commented Jul 17, 2024

Example of previous attempts to re-think usage of Filter

async function prepareSubscription(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Priority
Development

No branches or pull requests

2 participants