You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Marten Seemann 3f024f703e
chore: update examples to v0.24.0 (#1936)
2 years ago
..
.gitignore examples: add basic pubsub-with-rendezvous example (#1738) 2 years ago
README.md examples: add basic pubsub-with-rendezvous example (#1738) 2 years ago
go.mod chore: update examples to v0.24.0 (#1936) 2 years ago
go.sum chore: update examples to v0.24.0 (#1936) 2 years ago
main.go examples: add basic pubsub-with-rendezvous example (#1738) 2 years ago

README.md

go-libp2p-pubsub chat with rendezvous example

This example project allows multiple peers to chat among each other using go-libp2p-pubsub.

Peers are discovered using a DHT, so no prior information (other than the rendezvous name) is required for each peer.

Running

Clone this repo, then cd into the examples/pubsub/basic-chat-with-rendezvous directory:

git clone https://github.com/libp2p/go-libp2p
cd go-libp2p/examples/pubsub/basic-chat-with-rendezvous

Now you can either run with go run, or build and run the binary:

go run .

# or, build and run separately
go build .
./chat

To change the topic name, use the -topic flag:

go run . -topic=adifferenttopic

Try opening several terminals, each running the app. When you type a message and hit enter in one, it should appear in all others that are connected to the same topic.

To quit, hit Ctrl-C.