Skip to content

Commit

Permalink
chore: fix c-bindings example (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaichaosun authored Nov 22, 2023
1 parent 61e0c55 commit 2af8cf7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions examples/c-bindings/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
"[email protected]",
waku_dns_discovery("enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im",
"", 0, on_response, (void *)&discoveredNodes);
printf("Discovered nodes: %s\n", discoveredNodes);

Expand Down
6 changes: 6 additions & 0 deletions examples/chat2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions examples/filter2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion waku/v2/protocol/relay/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2af8cf7

Please sign in to comment.