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

How Peer discovery works? #52

Open
adamskrodzki opened this issue Aug 10, 2019 · 1 comment
Open

How Peer discovery works? #52

adamskrodzki opened this issue Aug 10, 2019 · 1 comment
Labels
question Further information is requested

Comments

@adamskrodzki
Copy link

adamskrodzki commented Aug 10, 2019

Hi,
I've tried to play around with this tutorial and modify the code
https://gateway.pinata.cloud/ipfs/QmZYWWiXpEJXm9neWFpHEHBc5YbQFTFkS4yL777eG64y1r/

first I've changed config
this.defaultOptions = { accessController: { write: ['*'] }}

so everyone connects to databese of the same Id and have write permissions on it.

I also configured IPFS as follows:

this.node = new IPFS({ relay: { enabled: true, hop: { enabled: true, active: true } }, preload: {enabled:true}, repo: './ipfs', EXPERIMENTAL: { pubsub: true } })

Now when I open this website in two windows (one of them incognito)
and I call
const peers = await this.node.swarm.peers()
I see both nodes connected to same 8 peers (for example "QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd" )

Now on one page i call
NPP.addNewPiece("abc","xyz")

there is no data on other window

If i connect two peers directly
NPP.connectToPeer("QmU4Qxk7zeZmoHJZddA672ku9DXRK76j4gAxU1HSF97grt")

messages starts floating from one node to another

my question is, why this 8 initial peers do not relay messages?

how can I discover others peers to connect to them ?

If there is houdrets or thousands of concurrent users viewing same page I guess browser do not have resources to connect to all new users. Should I manuall choose which peers to connect to?

@RichardLitt RichardLitt added the question Further information is requested label Sep 10, 2019
@julienmalard
Copy link
Contributor

Hello,
A bit late to reply, butt I've just found a solution to a similar problem - try setting up a free WebRTC star process on Heroku https://dev.to/suda/spinning-up-a-free-ipfs-webrtc-star-discovery-server-with-heroku-284p
Connections then work (for me at least).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants