js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

Chat example - global?

Open jacekv opened this issue 5 years ago • 2 comments

Hey guys, I started to play around with libp2p and tried the chat example. I realized, that the code works only in a local network. I tried to have a look if there is a way to do it over the internet, but haven't found anything.

I tried to discover a node using the CID. Client A connects to some bootstrap nodes and outputs it's own CID.

'/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ',
  '/ip4/104.236.176.52/tcp/4001/p2p/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z',
  '/ip4/104.236.179.241/tcp/4001/p2p/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
  '/ip4/162.243.248.213/tcp/4001/p2p/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
  '/ip4/128.199.219.111/tcp/4001/p2p/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
  '/ip4/104.236.76.40/tcp/4001/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
  '/ip4/178.62.158.247/tcp/4001/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
  '/ip4/178.62.61.185/tcp/4001/p2p/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
  '/ip4/104.236.151.122/tcp/4001/p2p/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx'

I started a second client who also used the bootstrap nodes. I provided the CID of the client A to the findPeer function, but no result. Is there any other way on how to find peers knowing the CID? Or do I have to know their multiaddress?

Best :)

jacekv avatar Aug 17 '20 13:08 jacekv

The chat example here is pretty basic. You might want to take a look at the more detailed example at https://github.com/libp2p/js-libp2p-examples/tree/hackfs. This branch in particular is for the recent HackFS and is designed to work on the public network.

jacobheun avatar Aug 17 '20 16:08 jacobheun

That looks good :) Thanks. In the recording, you spoke at the end about how to broadcast to a small set of peers in a network of millions. I didn't get if it already possible or not. Is it actually possible to communicate with a small set of peers?

jacekv avatar Aug 18 '20 04:08 jacekv

Closing as stale

maschad avatar Sep 28 '23 18:09 maschad