chore: fix c-bindings example (#915)

This commit is contained in:
kaichao 2023-11-22 19:35:20 +08:00 committed by GitHub
parent 61e0c55e76
commit 2af8cf7344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View File

@ -85,7 +85,7 @@ make mobile-ios
- [Send messages using Waku Lightpush](docs/api/lightpush.md)
- [Encrypting and decrypting Waku Messages](docs/api/encoding.md)
- [Retrieve message history using Waku Store](docs/api/store.md)
- [C Bindings](library/README.md)
- [C Bindings](library/c/README.md)
- [Waku Specs](https://rfc.vac.dev/spec), has information of [waku topics](https://rfc.vac.dev/spec/23/), wakuv1/[wakuv2](https://rfc.vac.dev/spec/14/) message, [rln relay](https://rfc.vac.dev/spec/58/) etc.
- [Enr](https://eips.ethereum.org/EIPS/eip-778), [Enrtree](https://eips.ethereum.org/EIPS/eip-1459)
- [devp2p](https://github.com/ethereum/go-ethereum/tree/master/cmd/devp2p) tool for playing with enr/entree sync tree. [Tutorial](https://geth.ethereum.org/docs/developers/geth-developer/dns-discovery-setup)

View File

@ -154,9 +154,7 @@ int main(int argc, char *argv[])
// To use dns discovery, and retrieve nodes from a enrtree url
char *discoveredNodes = NULL;
waku_dns_discovery("enrtree://"
"AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV"
"6SAYBM@test.waku.nodes.status.im",
waku_dns_discovery("enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im",
"", 0, on_response, (void *)&discoveredNodes);
printf("Discovered nodes: %s\n", discoveredNodes);

View File

@ -17,6 +17,12 @@ To start the `chat2` application in its most basic form, run the following from
./build/chat2
```
You may need to set DNS server if behind a VPN,
```
./build/chat2 --dns-discovery-name-server 8.8.8.8
```
## Specifying a static peer
In order to connect to a *specific* node as [`relay`](https://specs.vac.dev/specs/waku/v2/waku-relay) peer, define that node's `multiaddr` as a `staticnode` when starting the app:

View File

@ -27,9 +27,9 @@ The app will run 2 nodes ("full" node and "light" node), with light node subscri
3. Light node submits a FilterSubscribeRequest through WakuFilterLightNode.Subscribe. This request is submitted to a particular peer.
Filter is stored in WakuFilterLightNode.subscriptions map. That's it.
4. Now we wait on WakuFilterLightNode.onRequest to process any further messages.
5. On receiving a message check and notify all subscribers on relevant channel (which is part of subscription obbject).
5. On receiving a message check and notify all subscribers on relevant channel (which is part of subscription object).
6. If a broadcaster is specified,
WakuNode.Subscribe has a message loop extracting WakuMessages from a wakurelay.Subscription object.It denotes a pubsub topic subscription.All envelopes are then submitted to node.broadcaster.
WakuNode.Subscribe has a message loop extracting WakuMessages from a wakurelay.Subscription object. It denotes a pubsub topic subscription. All envelopes are then submitted to node.broadcaster.
### Full Node
1. Full node is created with option WithWakuFilterFullNode.
2. We read incoming messages in WithWakuFilterFullNode.onRequest(). It is set as a stream handler on wakunode.Host for WakuFilterProtocolId.

View File

@ -14,7 +14,7 @@ func WithPubSubTopic(pubsubTopic string) PublishOption {
}
}
// WithPubSubTopic is used to indicate that the message should be broadcasted in the default pubsub topic
// WithDefaultPubsubTopic is used to indicate that the message should be broadcasted in the default pubsub topic
func WithDefaultPubsubTopic() PublishOption {
return func(params *publishParameters) {
params.pubsubTopic = DefaultWakuTopic