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

Retrieve Store Messages when resuming connectivity #252

Open
D4nte opened this issue Aug 4, 2021 · 2 comments
Open

Retrieve Store Messages when resuming connectivity #252

D4nte opened this issue Aug 4, 2021 · 2 comments
Labels
track:restricted-run Restricted run track (Secure Messaging/Waku Product), e.g. filter, WebRTC

Comments

@D4nte
Copy link
Contributor

D4nte commented Aug 4, 2021

Problem

When a dApp using js-waku is offline, relay messages are not received.
Same for filter messages.

Solution

To ensure that no message were missed, a store query should be done once a device resume connectivity.

Definition of Done

A guide that demonstrate how to watch loss of connectivity to then do a store query to retrieve any missed messages.
Can start with filter as it may be easier to detected disconnectivity.

Notes

This guide may be accompanied by a set of helpful API to make it easier to enable/use.

The loss of connectivity refers to relay nodes, that forward messages.
From testing js-libp2p behaviour, it does not seem that the peer:disconnect event on the connectManager is triggered when there is a loss of connection.
Most likely, only a failed attempt to contact a peer allows the node to learn that the peer is not reachable anymore.
libp2p-interfaces/pubsub handles this by calling _onPeerDisconnected if a message is failed to send to a peer.

One could either hook this method or watch the number of available relay peers to know whether we are connected.
Then, the start/end time field should be used in the store query to only retrieve messages in the timeframe where we are offline.

Inspire yourself to what status is doing: https://rfc.vac.dev/spec/27/#peer-connectivity

Card to write RFC for relay ping: https://github.com/status-im/js-waku/projects/1#card-65707839

@fryorcraken fryorcraken added the track:restricted-run Restricted run track (Secure Messaging/Waku Product), e.g. filter, WebRTC label Aug 25, 2022
@fryorcraken fryorcraken moved this to Todo in Waku Aug 25, 2022
@fryorcraken fryorcraken added this to Waku Aug 25, 2022
@fryorcraken
Copy link
Collaborator

Something to think about is how to handle duplicates (e.g. message from filter and store), see waku-org/pm#9

@fryorcraken
Copy link
Collaborator

Duplicate handling could be done via the Deterministic Message Hashing as specified in vacp2p/rfc#573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
track:restricted-run Restricted run track (Secure Messaging/Waku Product), e.g. filter, WebRTC
Projects
Status: To Do
Development

No branches or pull requests

2 participants