nwaku/examples/v2/README.md

34 lines
1.0 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# basic2
TODO
# publisher/subscriber
Within `examples/v2` you can find a `publisher` and a `subscriber`. The first one publises messages to the default pubsub topic to a given content topic, and the second one runs forever listening to that pubsub topic and printing the content it receives.
**Some notes:**
* These examples are meant to work even in if you are behind a firewall and you can't be discovered by discv5.
* You only need to provide a reachable bootstrap peer (see our [fleets](https://fleets.status.im/))
* The examples are meant to work out of the box.
* Note that both services wait for some time until a given minimum amount of connections are reached. This is to ensure messages are gossiped.
**Compile:**
Make all examples.
```console
make example2
```
**Run:**
Wait until the subscriber is ready.
```console
./build/subscriber
```
And run a publisher
```console
./build/publisher
```
See how the subscriber received the messages published by the publisher. Feel free to experiment from different machines in different locations.