Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Understanding discovery, dial and connection flow #154

Open
owenauch opened this issue Jul 11, 2018 · 1 comment
Open

Understanding discovery, dial and connection flow #154

owenauch opened this issue Jul 11, 2018 · 1 comment
Labels
kind/support A question or request for support status/ready Ready to be worked

Comments

@owenauch
Copy link

owenauch commented Jul 11, 2018

I've been working with this library and really like it, but I had some questions about the proper way to use it, and what each function does. What I want to do is allow each peer to connect to many random peers that are also searching for peers using a private signaling server, and then be able to arbitrarily and programmatically pass data between one another.

Right now, I'm using webrtc-star as my discovery and transport and I'm adding a private signaling server to my peerInfo.multiaddrs from the start. When I do this with two different peers, they trigger on.("peer:discovery") repeatedly. What I don't yet understand is whether I should call dialProtocol when I discover a peer and open a pull-stream on both sides so data can be arbitrarily passed, or if there's another, more elegant way. Because when I implement something like that, on("peer:connect") and on("peer:disconnect") are never triggered. Should my flow to connecting to peers look different? Also, what is the best way to store info on my peers so I can keep track of them and continue to communicate with them? I was storing the peerInfo in a simple object, but I run into a problem because the Connection object returned by handle doesn't have peerInfo for some reason -- it says peerInfo not set. I also found https://github.com/libp2p/js-peer-book as a potential better way to keep track of it, but it's very poorly documented.

Essentially, what I'm asking is what does the proper flow for using this library in conjunction with libp2p look like? Is there an example with more sustained communication than the chat example in js-libp2p?

@vasco-santos vasco-santos added the kind/support A question or request for support label Jul 19, 2018
@daviddias daviddias added the status/ready Ready to be worked label Aug 15, 2018
@sidravic
Copy link

sidravic commented Oct 7, 2018

@owenauch Were you able to find a good answer to your question. I'm stuck in a similar situation looking for some guidance. Would appreciate your help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

4 participants