IPFS - pubsub从浏览器连接到对等体

问题描述 投票:3回答:1

我使用以下配置在浏览器中运行ipfs节点:

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'
      ]
    }
  }
});

我订阅了一个主题,可以找到同行+在浏览器标签上发送消息但不在互联网上!

我正在使用ipfs-js并通过webpack打包它。

如何通过网络发现和发送对等消息?

p2p ipfs
1个回答
0
投票

尝试添加

      API: '',
      Gateway: '',

像你这样的Addresses

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: '',
    }
  }
});

我没有一个很好的解释为什么,但my webapp做同样的事情(webpacked js-ipfs为pubsub-room)有配置和工作。

© www.soinside.com 2019 - 2024. All rights reserved.