mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-07 15:23:07 +00:00
chore: prioritize autosharding over static sharding
This commit is contained in:
parent
51766a8427
commit
430e395e6f
@ -24,7 +24,22 @@ 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.
|
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 auto sharding (recommended)
|
||||||
|
const node = await createLightNode({
|
||||||
|
defaultBootstrap: true,
|
||||||
|
networkConfig: {
|
||||||
|
clusterId: 1,
|
||||||
|
contentTopics: ["/my-app/1/notifications/proto"],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alternative network configuration
|
||||||
|
|
||||||
|
If your project requires a specific network configuration, you can use static sharding:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Create node with static sharding
|
// Create node with static sharding
|
||||||
@ -35,15 +50,6 @@ const node = await createLightNode({
|
|||||||
shards: [0, 1, 2, 3],
|
shards: [0, 1, 2, 3],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create node with auto sharding
|
|
||||||
const node = await createLightNode({
|
|
||||||
defaultBootstrap: true,
|
|
||||||
networkConfig: {
|
|
||||||
clusterId: 1,
|
|
||||||
contentTopics: ["/my-app/1/notifications/proto"],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Connect to remote peers
|
## Connect to remote peers
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user