mirror of https://github.com/status-im/js-waku.git
Do not recommend protobuf
Yet provide guide on how to use protobuf.
This commit is contained in:
parent
bb7ae2f30a
commit
2381adfd17
|
@ -14,7 +14,7 @@ The format for content topics is as follows:
|
|||
- `content-topic-name`: The actual content topic name to use for filtering.
|
||||
If your dApp uses DappConnect for several features,
|
||||
you should use a content topic per feature.
|
||||
- `encoding`: The encoding format of the message, we recommend using Protobuf: `proto`.
|
||||
- `encoding`: The encoding format of the message, Protobuf is most often used: `proto`.
|
||||
|
||||
For example: Your dApp's name is SuperCrypto,
|
||||
it enables users to receive notifications and send private messages.
|
||||
|
|
|
@ -75,10 +75,12 @@ await waku.relay.send(wakuMessage);
|
|||
# Use Protobuf
|
||||
|
||||
Sending strings as messages in unlikely to cover your dApps needs.
|
||||
To include structured objects in Waku Messages,
|
||||
we recommend you use [protobuf](https://developers.google.com/protocol-buffers/).
|
||||
|
||||
First, let's define a data structure.
|
||||
Waku v2 protocols use [protobuf](https://developers.google.com/protocol-buffers/) [by default](https://rfc.vac.dev/spec/10/).
|
||||
|
||||
Let's review how you can use protobuf to include structured objects in Waku Messages.
|
||||
|
||||
First, define a data structure.
|
||||
For this guide, we will use a simple chat message that contains a timestamp and text:
|
||||
|
||||
```js
|
||||
|
|
|
@ -13,7 +13,7 @@ allowing you to retrieve them at a later time.
|
|||
The Waku Store protocol is best-effort and does not guarantee data availability.
|
||||
Waku Relay should still be preferred when online;
|
||||
Waku Store can be used after resuming connectivity:
|
||||
when the dApp starts for example.
|
||||
For example, when the dApp starts.
|
||||
|
||||
In this guide, we'll review how you can use Waku Store to retrieve messages.
|
||||
|
||||
|
@ -56,9 +56,11 @@ await Promise.all(nodes.map((addr) => waku.dial(addr)));
|
|||
|
||||
# Use Protobuf
|
||||
|
||||
We recommend you use [protobuf](https://developers.google.com/protocol-buffers/) for messages.
|
||||
Waku v2 protocols use [protobuf](https://developers.google.com/protocol-buffers/) [by default](https://rfc.vac.dev/spec/10/).
|
||||
|
||||
First, let's define a data structure.
|
||||
Let's review how you can use protobuf to send structured data.
|
||||
|
||||
First, define a data structure.
|
||||
For this guide, we will use a simple news article that contains a date of publication, title and body:
|
||||
|
||||
```js
|
||||
|
|
Loading…
Reference in New Issue