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

I need help o(╥﹏╥)o #406

Closed
Ice-Storm opened this issue Aug 30, 2018 · 8 comments
Closed

I need help o(╥﹏╥)o #406

Ice-Storm opened this issue Aug 30, 2018 · 8 comments
Labels
kind/support A question or request for support

Comments

@Ice-Storm
Copy link
Contributor

I don't know how to combine with libp2p-kad-dht. confused me for days. how to find a peer? Can you give me a demo?
o(╥﹏╥)o

@upperwal
Copy link
Contributor

@Ice-Storm Have a look at libp2p/go-libp2p-examples repo. Some example that support dht are under review look at chat-with-rendezvous and chat-with-tor. They both support kad-dht and peer discovery.

@Stebalien Stebalien added the kind/support A question or request for support label Aug 30, 2018
@Ice-Storm
Copy link
Contributor Author

Thank you very much!!

@Ice-Storm
Copy link
Contributor Author

Ice-Storm commented Sep 11, 2018

@upperwal This example help me a lot, But i still confused that how to implement 'root' node.
This example connect some nodes by bootstrap, but bootstrap node how to init ?

@upperwal
Copy link
Contributor

@Ice-Storm Creating a new bootstrapping node is as simple as starting a new node with DHT support [atleast for now]. @Stebalien can you please confirm this.

@florianlenz is working on a bootstrap module plus the community is also working on a new rendezvous protocol for the same.

Maybe we can have a sample code in examples to start a bootstrap node.

@Ice-Storm
Copy link
Contributor Author

@upperwal thank you. I am trying it out.

@Ice-Storm
Copy link
Contributor Author

@upperwal Sorry to bother you. I just had a quick question. When I run the chat example, I find that the message does not broadcast when multiple terminals are started. like this
wechatimg322
Could you give some reason? all connect use same net.Stream ?
Thank you.

@upperwal
Copy link
Contributor

upperwal commented Oct 8, 2018

I find that the message does not broadcast when multiple terminals are started

Yeah, it won't broadcast and your message might be going to either one of the peer/terminal at a time.

This is happening because each peer opens a new stream for chat and starts a new goroutine to read from stdin and this is the problem. One stdin stream and multiple goroutines to read it (one for each connected peer). Only one of the goroutine will succeed and send the messege to one peer.

A better chat implantation would be to use a pubsub model where peers can subscribe to chat rooms and everyone in that room will receive the message.

Another way would be to start one goroutine which read stdin and copy the message to all connected peers stream.

@Ice-Storm
Copy link
Contributor Author

Thank you. I'm study that how to constructor p2p network and related knowledge. you replay help me a lot. i hope to make more contributions to this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

3 participants