-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: improve peer discovery #245
Conversation
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall changes make sense and seems to work as expected when testing with a couple of devices (+ Wireshark)
although i think this is handled by the inclusion of other network-related deps, to be safe, may be worth updating the AndroidManifest.xml
file with what the zeroconf dependency requires:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
Ping me for another review when core is updated!
Added the Android permissions in e4bf013. I'll let you know when I've updated |
I think this is all ready to go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of non-blocking comments but changes look good 👍
Depends on digidem/comapeo-core#550.I recommend reviewing this one commit at a time.
Our peer discovery system is unreliable on some networks. This replaces it with a native local service discovery system where we tell
@mapeo/core
about the peers we find.Closes digidem/comapeo-core#474.