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

Improve local device discovery on different networks #474

Closed
EvanHahn opened this issue Feb 12, 2024 · 1 comment · Fixed by #550 or digidem/comapeo-mobile#245
Closed

Improve local device discovery on different networks #474

EvanHahn opened this issue Feb 12, 2024 · 1 comment · Fixed by #550 or digidem/comapeo-mobile#245
Assignees
Labels
mvp Requirement for MVP

Comments

@EvanHahn
Copy link
Contributor

EvanHahn commented Feb 12, 2024

In our testing, we've found some issues where peers aren't discovered properly. We should fix that.

(This issue isn't super fleshed out because we had issues on particular wifi networks, and it's hard to describe those in a useful way here.)

@EvanHahn EvanHahn self-assigned this Feb 12, 2024
@EvanHahn EvanHahn added the mvp Requirement for MVP label Feb 12, 2024
EvanHahn added a commit to digidem/comapeo-mobile that referenced this issue Apr 4, 2024
We need the device's wifi state at a few points in the app. The way we
previously did this had a few disadvantages:

1. If you were connected to wifi and another network (like cellular),
   we might get the wrong network's IP address. You might also be unable
   to fetch the SSID.

2. It used two different dependencies, because neither does exactly what
   we want.

3. These dependencies rely on deprecated APIs.

This change fixes those by implementing a native module, `WifiModule`,
to address these problems. It also adds an React hook for using it.

I think this is a useful change on its own, but will also help us as we
try to [improve local peer discovery][0] in upcoming work.

[0]: digidem/comapeo-core#474
EvanHahn added a commit to digidem/comapeo-mobile that referenced this issue Apr 4, 2024
We need the device's wifi state at a few points in the app. The way we
previously did this had a few disadvantages:

1. If you were connected to wifi and another network (like cellular),
   we might get the wrong network's IP address. You might also be unable
   to fetch the SSID.

2. It used two different dependencies, because neither does exactly what
   we want.

3. These dependencies rely on deprecated APIs.

This change fixes those by implementing a native module, `WifiModule`,
to address these problems. It also adds an React hook for using it.

I think this is a useful change on its own, but will also help us as we
try to [improve local peer discovery][0] in upcoming work.

[0]: digidem/comapeo-core#474
EvanHahn added a commit that referenced this issue Apr 11, 2024
See also: <digidem/comapeo-mobile#245>.

Our peer discovery system is unreliable on some networks. We'd like to
replace it with [a native local service discovery system][0].

To do this, the frontend needs to tell the backend about peers it finds.
In other words, we need to "invert" peer discovery.

Here's pseudocode for what the frontend needs to do:

    const {name, port} = await mapeoApi.startLocalPeerDiscoveryServer()
    zeroconf.publishService({name, port})
    zeroconf.on('resolved', (peer) => {
      mapeoApi.connectPeer(peer)
    })

This implements that by removing our mDNS system and replacing it with
these public APIs.

Closes [#474][1].

[0]: https://www.npmjs.com/package/react-native-zeroconf
[1]: #474
EvanHahn added a commit to digidem/comapeo-mobile that referenced this issue Apr 15, 2024
Our peer discovery system is unreliable on some networks. This replaces
it with [a native local service discovery system][0] where we tell
`@mapeo/core` about the peers we find.

Closes <digidem/comapeo-core#474>.

[0]: https://www.npmjs.com/package/react-native-zeroconf

Co-authored-by: Andrew Chou <[email protected]>
@EvanHahn
Copy link
Contributor Author

This was fixed in #550 and digidem/comapeo-mobile#245.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mvp Requirement for MVP
Projects
None yet
1 participant