waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
162 stars 41 forks source link

feat: peer management for protocols (with disconnection management) #2002

Open danisharora099 opened 2 months ago

danisharora099 commented 2 months ago

This is a feature request

Problem

For Filter and LightPush, every time a new LP request/new subscription is created, getPeers() is called -- this is called every time which gives us a new set of peers to use for each request/subscription.

Further, we wish to discard a peer if it fails, and renew it with another peer. This is not trivial to do if we rely on getting a new set of peers each time.

Proposed Solutions

LightPush:

Filter:

Notes

chaitanyaprem commented 1 month ago

Renew peer if filter ping fails on a node Not sure if we can depend on this as expected filter ping duration is 1 minute. Maybe better to listen on disconnection signal from a peer and then act on it, which can be based on periodic ping that is run more often. In go-waku/status-go all connected peers are pinged every 10 seconds.