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

Not seeing any connected peers when using js-ipfs in browser #800

Closed
@zabirauf

Description

@zabirauf

I have the following code to connect to IPFS

const repoPath = String(Math.random());
const node = new IPFS({
  repo: repoPath,
  IpfsDataDir: '/tmp/testipfs-zabirauf-7',
  // dev server: webrtc-star-signalling.cloud.ipfs.team
  SignalServer: 'star-signal.cloud.ipfs.team', // IPFS dev server
  Discovery: {
    MDNS: {
      Enabled: false,
      Interval: 10
    },
    webRTCStar: {
      Enabled: true
    }
  },
});
 
// Create the IPFS node instance
    node.init({ emptyRepo: true, bits: 2048 }, (err: any) => {
        if (err) {
            throw err;
        }
 
        node.load((err: any) => {
            if (err) {
                throw err;
            }
            node.goOnline((err: any) => {
                if (err) {
                    throw err;
                }
                node.id().then((res: any) => {
                    // TEST
                    (<any>window).ipfsNode = node;
                    callback(<IdResponse>res);
                });
            });
        });
    });

The node is connected, isOnline is true but when I get the list of peers I get nothing. Even when trying to get a file, nothing. Is there a known issue in using js-ipfs in browser or is there something wrong in the code I have to connect to IPFS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportA question or request for support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions