Skip to content

Commit

Permalink
chore: prioritize autosharding over static sharding
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Oct 1, 2024
1 parent d4891bf commit 428e184
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions docs/guides/js-waku/light-send-receive.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,30 @@ await node.start();
When the `defaultBootstrap` parameter is set to `true`, your node will be bootstrapped using the [default bootstrap method](/guides/js-waku/configure-discovery#default-bootstrap-method). Have a look at the [Bootstrap Nodes and Discover Peers](/guides/js-waku/configure-discovery) guide to learn more methods to bootstrap nodes.
:::

A node needs to know how to route messages. By default, it will use The Waku Network configuration (`{ clusterId: 1, shards: [0,1,2,3,4,5,6,7] }`). If your project uses a different network configuration, you can configure this using the `networkConfig` parameter:
A node needs to know how to route messages. By default, it will use The Waku Network configuration (`{ clusterId: 1, shards: [0,1,2,3,4,5,6,7] }`). For most applications, it's recommended to use autosharding:

```js
// Create node with static sharding
// Create node with auto sharding (recommended)
const node = await createLightNode({
defaultBootstrap: true,
networkConfig: {
clusterId: 1,
shards: [0, 1, 2, 3],
contentTopics: ["/my-app/1/notifications/proto"],
},
});
```

### Alternative network configuration

// Create node with auto sharding
If your project requires a specific network configuration, you can use static sharding:

```js
// Create node with static sharding
const node = await createLightNode({
defaultBootstrap: true,
networkConfig: {
clusterId: 1,
contentTopics: ["/my-app/1/notifications/proto"],
shards: [0, 1, 2, 3],
},
});
```
Expand Down

0 comments on commit 428e184

Please sign in to comment.