Skip to content

Commit

Permalink
add steps on retrieving connected peers
Browse files Browse the repository at this point in the history
  • Loading branch information
LordGhostX committed Nov 30, 2023
1 parent fc3d7fb commit db3b98b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/guides/js-waku/configure-discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ hide_table_of_contents: true

This guide provides detailed steps to bootstrap your your node using [Static Peers](/learn/concepts/static-peers) and discover peers in the Waku Network using [DNS Discovery](/learn/concepts/dns-discovery).

:::info
If you do not set up a bootstrap node or discovery mechanism, your node will not connect to any remote peer.
:::

:::tip
Until [node incentivisation](/learn/research#prevention-of-denial-of-service-dos-and-node-incentivisation) is in place, you should [operate extra nodes](/#run-a-waku-node) alongside the ones provided by the Waku Network. When running a node, we recommend using the [DNS Discovery and Static Peers](#configure-dns-discovery-and-static-peers) configuration to connect to both the Waku Network and your node.
:::
Expand Down Expand Up @@ -189,6 +193,16 @@ const node = await createLightNode({
});
```

:::info
If you do not set up a bootstrap node or discovery mechanism, your node will not connect to any remote peer.
:::
## Retrieving connected peers

You can retrieve the array of peers connected to a node using the `libp2p.getPeers()` function within the `@waku/sdk` package:

```js
import { createLightNode, waitForRemotePeer } from "@waku/sdk";

const node = await createLightNode({ defaultBootstrap: true });
await waitForRemotePeer(node);

// Retrieve array of peers connected to the node
console.log(node.libp2p.getPeers());
```

0 comments on commit db3b98b

Please sign in to comment.