4

I am running an ipfs node in the browser using the following config:

const node = new IPFS({ 
  repo: 'ipfs-' + Math.random(),
  EXPERIMENTAL: {
    pubsub: true,
  },
  config: {
    Addresses: {
      Swarm: [
        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'
      ]
    }
  }
});

I have subscribed to a topic and can find peers + message them across browser tabs but not on the internet!

I am using ipfs-js and packaging it via webpack.

How do I discover and message peers across the network?

dendog
  • 2,976
  • 5
  • 26
  • 63

1 Answers1

0

Try adding

      API: '',
      Gateway: '',

to your Addresses like so:

const node = new IPFS({ 
  repo: 'ipfs-' + Math.random(),
  EXPERIMENTAL: {
    pubsub: true,
  },
  config: {
    Addresses: {
      Swarm: [
        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'
      ],
      API: '',
      Gateway: '',
    }
  }
});

I don't have a good explanation for why, but my webapp doing the same thing (webpacked js-ipfs for pubsub-room) has that config and works.

npfoss
  • 423
  • 5
  • 14