waku-org / waku-rust-bindings

Rust wrapper over go-waku ffi
14 stars 6 forks source link

API for Topics management #53

Open hopeyen opened 1 year ago

hopeyen commented 1 year ago

It would be really nice to have a function returning topics related to the running node, such as

This makes it easier to track and manage the topics

danielSanchezQ commented 1 year ago

@richard-ramos do we have something like that in the underlaying lib?

richard-ramos commented 1 year ago

Hm. In go-waku we could access the list of topics via wakuNode.Relay().Topics() so we could expose that easily. For the list of peers, in the current version of go-waku filter, there's no subscription management at client side, so there's no easy way to obtain the list of peers. One solution i could provide could be to instead of returning true when waku_filter_subscribe is executed, to instead return an object with the info for the subscription:

{
  peerId: ....,
  topic: ....,
  contentTopics: [ ... ]
}

and then subscription management could be done by the application using go-waku library.

...

In https://github.com/vacp2p/rfc/pull/562 a lot of improvements over filter protocol are being done, and once they land in go-waku and nwaku i believe it will be easier to provide a list of active filter subscriptions.

chair28980 commented 5 months ago

This will need to be added to nwaku when we switch from go-waku to nwaku for Rust bindings.

chair28980 commented 4 months ago

Added to Epic: https://github.com/waku-org/nwaku/issues/2420