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

Connection Management

Open fryorcraken opened this issue 1 year ago • 0 comments

Problem

In a browser environment, loss of connectivity may happen.

When it happens, this would impede the application to receive and send messages.

Strategies need to be designed to:

  • detect a loss of connection
  • Automated actions when resuming a connection
    • auto reconnect to remote peer
    • Auto trigger some protocols (e.g. Waku Store #252)
    • Renewing Filter subscription
    • Waiting for peer to be in mesh relay before considering the action live (eg waitForRemotePeer)
  • cope with lack of connectivity when trying to use a protocol: retry strategy, feedback to the app and guideline on how to handle
    • Querying message using Waku Store: eg #913
    • Trying to send a message with light push

Proposed Solutions

The result of this issue would be a mix of:

  • Documentation to guide the developers in handling failure
  • Strategy embedded in the protocols (e.g. retry)
  • Helper library that can provide utility to developers (e.g. auto store query, auto filter renewal)

At this stage it is not sure what should go in waku core and what should be a library helper.

Steps

  • [ ] Investigate the effect of connection loss
    • [ ] libp2p events w.r.t. connected/disconnected peers
    • [ ] auto-connection to disconnected peers
    • [ ] Waku Filter subscription state after disconnection/re-connection
    • [ ] Waku Relay state after disconnection/re-connection
    • [ ] Usage of Waku Light Push during connection loss
    • [ ] Usage of Waku Store during connection loss
  • [ ] Review possible automated actions upon re-connection (based on learnings from above)
    • [ ] auto store query #913
    • [ ] auto filter subscribe

Notes

https://github.com/libp2p/js-libp2p/issues/744

fryorcraken avatar Aug 31 '22 02:08 fryorcraken