From f355e66e55184c539b3029e8a04de36f73e9f4ba Mon Sep 17 00:00:00 2001 From: LordGhostX <47832826+LordGhostX@users.noreply.github.com> Date: Thu, 30 Nov 2023 18:42:27 +0100 Subject: [PATCH] docs update (#143) --- docs/guides/getting-started.md | 2 +- docs/guides/js-waku/configure-discovery.md | 20 +++++++++++++++++--- docs/guides/nwaku/configure-nwaku.md | 4 ++++ docs/guides/nwaku/run-node.md | 6 +++++- docs/learn/waku-network.md | 2 +- sidebars.js | 4 ++++ 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/guides/getting-started.md b/docs/guides/getting-started.md index 13980a8..b7c1677 100644 --- a/docs/guides/getting-started.md +++ b/docs/guides/getting-started.md @@ -43,7 +43,7 @@ Waku provides integrations tailored for mobile applications, enabling Waku to ru | | Description | Documentation | | - | - | - | -| [REST API](https://waku-org.github.io/waku-rest-api/) | REST API interface provided by `nwaku` and `go-waku` to interact with the Waku Network | [Waku Node REST API Spec](https://waku-org.github.io/waku-rest-api/) | +| [REST API](https://waku-org.github.io/waku-rest-api/) | REST API interface provided by `nwaku` and `go-waku` to interact with the Waku Network | [Waku Node REST API Reference](https://waku-org.github.io/waku-rest-api/) | | [@waku/react](https://www.npmjs.com/package/@waku/react) | React components and UI adapters designed for seamless integration with `@waku/sdk` | [Build React DApps Using @waku/react](/guides/js-waku/use-waku-react) | | [@waku/create-app](https://www.npmjs.com/package/@waku/create-app) | Starter kit to bootstrap your next `@waku/sdk` project from various example templates | [Scaffold DApps Using @waku/create-app](/guides/js-waku/use-waku-create-app) | | [nwaku-compose](https://github.com/waku-org/nwaku-compose) | Pre-configured Docker Compose setup for running and monitoring a `nwaku` node using Prometheus and Grafana | [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) | \ No newline at end of file diff --git a/docs/guides/js-waku/configure-discovery.md b/docs/guides/js-waku/configure-discovery.md index 1d8b683..684bf45 100644 --- a/docs/guides/js-waku/configure-discovery.md +++ b/docs/guides/js-waku/configure-discovery.md @@ -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. ::: @@ -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. -::: \ No newline at end of file +## 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()); +``` \ No newline at end of file diff --git a/docs/guides/nwaku/configure-nwaku.md b/docs/guides/nwaku/configure-nwaku.md index f4fb4cd..c0b944a 100644 --- a/docs/guides/nwaku/configure-nwaku.md +++ b/docs/guides/nwaku/configure-nwaku.md @@ -34,6 +34,10 @@ Browser nodes can only connect to nodes with a domain name and secure WebSocket This example describes configuring a domain name that resolves to your node's IP address and is unrelated to [DNS Discovery](/learn/concepts/dns-discovery). ::: +:::tip +You can use the domain name provided by your cloud provider to configure the domain name for your node. +::: + ## Configure store protocol and message store To enable message caching and serve them to network peers, enable the [Store protocol](/learn/concepts/protocols#store) using the following configuration options: diff --git a/docs/guides/nwaku/run-node.md b/docs/guides/nwaku/run-node.md index cbcf381..cfa33fa 100644 --- a/docs/guides/nwaku/run-node.md +++ b/docs/guides/nwaku/run-node.md @@ -50,7 +50,7 @@ Once you have gotten the `nwaku` binary, run it using the [default configuration ``` :::tip -To learn how to customise the configuration of a `nwaku` node, have a look at the [Node Configuration Methods](/guides/nwaku/config-methods) and [Node Configuration Options](/guides/nwaku/config-options) guides. +To learn how to customise the configuration of a `nwaku` node, have a look at the [Node Configuration Methods](/guides/nwaku/config-methods) and [Node Configuration Examples](/guides/nwaku/configure-nwaku) guides. ::: ## Bootstrap the node @@ -104,6 +104,10 @@ curl --location 'http://127.0.0.1:8645/debug/v1/info' \ The `listenAddresses` field stores the node's listening addresses, while the `enrUri` field stores the discoverable `ENR` URI for peer discovery. ::: +:::tip +We suggest [configuring WebSocket transport](/guides/nwaku/configure-nwaku#configure-websocket-transport) for your node to enable support and serving of browser peers using [@waku/sdk](/guides/js-waku/). +::: + ## Find the node addresses You can find the addresses of a running node through its logs or by calling the [Get node info](https://waku-org.github.io/waku-rest-api/#get-/debug/v1/info) endpoint of the [REST API](https://waku-org.github.io/waku-rest-api/). diff --git a/docs/learn/waku-network.md b/docs/learn/waku-network.md index bd4320f..44d120a 100644 --- a/docs/learn/waku-network.md +++ b/docs/learn/waku-network.md @@ -4,7 +4,7 @@ hide_table_of_contents: true --- :::info -The public Waku Network replaces the previous experimental shared routing layer based on a default pubsub topic (`/waku/2/default-waku/proto`). If your project currently uses this or any other shared pubsub topics, we encourage you to migrate to the public Waku Network with built-in DoS protection, better scalability, etc. +The public Waku Network replaces the previous experimental shared routing layer based on a default pubsub topic (`/waku/2/default-waku/proto`). If your project currently uses this or any other shared pubsub topics, we encourage you to migrate to the public Waku Network with built-in DoS protection, with built-in DoS protection, scalability and reasonable bandwidth usage. ::: The Waku Network is a shared p2p messaging network that is open-access, useful for generalized messaging, privacy-preserving, scalable and accessible even to resource-restricted devices. Some of the most prominent features include: diff --git a/sidebars.js b/sidebars.js index addce68..13a1b65 100644 --- a/sidebars.js +++ b/sidebars.js @@ -19,6 +19,10 @@ const sidebars = { "guides/nwaku/configure-nwaku", "guides/nwaku/config-methods", "guides/nwaku/config-options", + { + type: 'html', + value: 'REST API Reference', + }, ] }, {