Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Unable to connect two browser tabs with a stand alone js-ipfs node #3235

Closed
negamaxi opened this issue Aug 20, 2020 · 4 comments
Closed

Unable to connect two browser tabs with a stand alone js-ipfs node #3235

negamaxi opened this issue Aug 20, 2020 · 4 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@negamaxi
Copy link
Contributor

  • Version: 0.49.0
  • Platform: Windows, Linux
  • Subsystem: browser environment (Firefox, Chrome)

Severity: High

Description:

I've used js-ipfs instance with a default config...

const ipfsNode = await ipfs.create();

...inside my web app and tried to connect two different browser tabs via pubsub. I've waited for hours, but there was no connection. ipfs.swarm.peers() was called every 10s, the result was always the same:

Снимок экрана от 2020-08-20 16-17-26

ipfs.pubsub.peers(topic) also was called every 10s and there was no peers at all.

I've looked through the web and found this config that make it work - my tabs start to see each other and discovered swarm peers list regularly changes:

  Addresses: {
    Swarm: [
      "/dns4/p2p.3box.io/tcp/9091/wss/p2p-webrtc-star/",
    ],
  }

Expected behaviour: js-ipfs discovers other peers out of the box without manual configuration, like go-ipfs do.

@negamaxi negamaxi added the need/triage Needs initial labeling and prioritization label Aug 20, 2020
@achingbrain
Copy link
Member

It's not very straightforward - there are some public webrtc servers but they tend to be under high load or unavailable so aren't really suitable for out-of-the-box use, more general tinkering, plus as a transport webrtc is quite heavyweight so you wouldn't want to (for example) connect to multiple signalling servers at a time.

go-ipfs has a much easier time of it (as does js-ipfs under node) as it can do things like open tcp connections whereas code running in the browser cannot.

There are a bunch of issues linked to from libp2p/js-libp2p#703 that will help this situation.

@negamaxi
Copy link
Contributor Author

@achingbrain Thank you for response. So it's a matter of time when in-browser peers start to see each other out-of-the-box? If so, any ideas how long it will take?

@vasco-santos
Copy link
Member

@negamaxi we aim to make that experience more out-of-the-box with the rendezvous protocol, followed by a large overhaul for the JS implementation of the DHT. You can follow libp2p/js-libp2p#703 to track the progress. We are targeting the rendezvous protocol for the next libp2p release [email protected]. It should be a big step towards this out-of-the-box discovery by having peers registered under a rendezvous namespace. The DHT work should start after that release, once we have the new spec for it.

@negamaxi
Copy link
Contributor Author

@vasco-santos nice to see there is a work in progress to make this happen. Thank you for pointing this out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

3 participants