Skip to content

Commit 5075569

Browse files
committed
improve gossip & protocols info
1 parent 809a7f4 commit 5075569

File tree

2 files changed

+50
-13
lines changed

2 files changed

+50
-13
lines changed

concepts/protocols.mdx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,32 @@
22
title: "Protocols"
33
---
44

5-
Placeholder: Overview of supported protocols and how to choose/design one.
5+
Assuming we have two endpoints connected, yay! Now we just have to… do something… with that connection. That’s where protocols come in.
6+
7+
## Introduction
8+
9+
A protocol sets up everything we need to both provide data we have locally when
10+
others request it, and ask other endpoints that run the protocol to do whatever
11+
business or application logic we need.
12+
13+
Coming from the world of HTTP client/server models, protocols are similar to
14+
request handlers. However, they go beyond request/response by creating multiple
15+
streams of data and usually include both initiating & accepting protocol
16+
connections in the same client.
17+
18+
Peer to peer protocols do not require a client/server distinction, both sides
19+
can initiate and accept connections. However, you can still build client/server
20+
style protocols on top of iroh if you want to.
21+
22+
Protocols are modules you compose together to add functionality to connections.
23+
Protocols exist for file transfer, game server sync, message broadcasting,
24+
document collaboration, all kinds of stuff. You can use off-the-shelf protocols
25+
to quickly add functionality, work directly with QUIC streams & build a fully
26+
custom protocol that does exactly what you want, or fork an existing protocol to
27+
get what you need.
28+
29+
## Learn more
30+
- [iroh-gossip](/connecting/gossip): creating swarms of peers for broadcasting messages on topics.
31+
- [iroh-blobs](/protocols/blobs): storing and transferring large binary blobs of data.
32+
- [iroh-docs](/protocols/docs): collaborative key-value store.
33+
- [Writing Custom Protocols](/protocols/writing-a-protocol): guide on building your own protocols on top of iroh.

connecting/gossip.mdx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@ Characteristics
1616
- Gossip spreads information redundantly across overlapping paths, which
1717
improves resilience but increases traffic.
1818

19-
How gossip compares to centralized systems
20-
- Central brokers (Kafka, MQTT, Pulsar) keep authoritative topic membership
21-
and provide stronger delivery guarantees, but introduce a single point of
22-
failure and operational overhead.
23-
- Gossip trades strict guarantees for decentralization, simplicity, and
24-
resilience in highly dynamic environments.
25-
26-
When to use gossip
27-
- Lightweight broadcast where eventual delivery is acceptable.
28-
- Dynamic membership (peers frequently join/leave or change addresses).
29-
- No single point of failure is desired.
30-
3119

3220
## iroh-gossip
3321

@@ -37,11 +25,18 @@ based on the papers
3725
[HyParView](https://asc.di.fct.unl.pt/~jleitao/pdf/dsn07-leitao.pdf) and
3826
[PlumTree](https://asc.di.fct.unl.pt/~jleitao/pdf/srds07-leitao.pdf).
3927

28+
### Installation
29+
```
30+
cargo add iroh-gossip
31+
```
32+
4033
Iroh provides a Router that takes an Endpoint and any protocols needed for the
4134
application. Similar to a router in webserver library, it runs a loop accepting
4235
incoming connections and routes them to the specific protocol handler, based on
4336
ALPN.
4437

38+
### Example
39+
4540
```rust
4641
use iroh::{protocol::Router, Endpoint, EndpointId};
4742
use iroh_gossip::{api::Event, Gossip, TopicId};
@@ -145,3 +140,17 @@ joined the topic:
145140
receiver.joined().await?;
146141
```
147142

143+
144+
## How gossip compares to centralized systems
145+
146+
- Central brokers (Kafka, MQTT, Pulsar) keep authoritative topic membership
147+
and provide stronger delivery guarantees, but introduce a single point of
148+
failure and operational overhead.
149+
- Gossip trades strict guarantees for decentralization, simplicity, and
150+
resilience in highly dynamic environments.
151+
152+
## When to use gossip
153+
154+
- Lightweight broadcast where eventual delivery is acceptable.
155+
- Dynamic membership (peers frequently join/leave or change addresses).
156+
- No single point of failure is desired.

0 commit comments

Comments
 (0)