js-waku icon indicating copy to clipboard operation
js-waku copied to clipboard

Provide an async function to wait for the next message on a filter subscription

Open fryorcraken opened this issue 1 year ago • 3 comments

This is a feature request

Problem

As a dev, I may prefer to do a await subscription.next() on a filter subscription rather than passing a callback function.

Proposed Solutions

We did implement some IReceiver with toSubscriptionIterator, I wonder if this can help? If so, it may just be a question of documenting its usage.

fryorcraken avatar Aug 07 '23 07:08 fryorcraken

Here is an example of how toSubscriptionIterator can be used to achieve await subscription.next() API

The next step would be to document it in a way that developers are aware of such an opportunity.

@LordGhostX let's discuss how we can achieve it.

weboko avatar Aug 31 '23 11:08 weboko

I propose to (also) expose an event-based API for Filter


I'll open an issue to track this separately: #1682

danisharora099 avatar Oct 09 '23 18:10 danisharora099

@LordGhostX are you able to pick this issue up?

chair28980 avatar Jan 04 '24 15:01 chair28980