You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/app/docs/examples/gossip-chat/page.mdx
+245Lines changed: 245 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -528,6 +528,251 @@ In either case, we still print a ticket to the terminal.
528
528
529
529
The smallest change, but a very important one, is that we go from using the `subscribe` method to the `subscribe_and_join` method. The `subscribe` method would return a `Topic` immediately. The `subscribe_and_join` method takes the given topic, joins it, and waits for someone else to join the topic before returning.
Copy file name to clipboardExpand all lines: src/app/docs/tour/2-relays/page.mdx
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,17 @@ Keep in mind, connections are end-2-end encrypted, which means relays can’t re
13
13
Coming back to our program, let’s add support for relays:
14
14
15
15
16
-
```
16
+
```rust
17
+
#[tokio::main]
18
+
asyncfnmain() ->anyhow::Result<()> {
19
+
letbuilder=iroh::Endpoint::builder()
20
+
.relay_mode(iroh::RelayMode::Default);
21
+
22
+
letendpoint=builder.bind().await?;
23
+
println!("node id: {:?}", endpoint.node_id());
24
+
25
+
Ok(())
26
+
}
17
27
```
18
28
19
29
Here we've set the relay mode to `Default`, but this hasn't actually changed anything. Our prior code had `relay_mode` implicitly set to `Default`, and this works because iroh comes with a set of free-to-use public relays by default, run by the number 0 team. You’re more than welcome to run your own relays, use the number 0 hosted solution [n0des.iroh.computer](https://n0des.iroh.computer), run your own, or, ideally all of the above! The code for relay servers is in the main iroh repo, and we release compiled binaries for relays on each release of iroh.
0 commit comments