Skip to content

Commit be6f29c

Browse files
author
Jared Stanbrough
committed
docs: guide updates
docs: strip `0:` from guide address various other guide edits
1 parent ae8756d commit be6f29c

4 files changed

Lines changed: 16 additions & 11 deletions

File tree

documentation/guides/rust/02-transports/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async fn main(mut ctx: Context) -> Result<()> {
130130

131131
```
132132

133-
Make sure the `echo_server` is started first.
133+
Make sure the `echo_service` is started first.
134134

135135
Run the example:
136136

documentation/guides/rust/04-forwarding/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ local worker.
3535

3636
When we receive a message indicating successful registration, the forwarding address of the `echo_service` is printed.
3737

38-
Copy the address printed after registration succeeds. The address is hexadecimal with a prefix of '0.'. You do not need
39-
to copy the '0.' portion of the address.
40-
4138
```rust
4239
async fn handle_message(&mut self, ctx: &mut Context, msg: Routed<String>) -> Result<()> {
4340
if &msg.as_str() == &"register" {
41+
let address = msg.reply().recipient().to_string();
4442
println!(
4543
"echo_service: My address on the hub is {}",
46-
msg.reply().recipient()
44+
address.strip_prefix("0:").unwrap()
4745
);
4846
Ok(())
4947
} else {
@@ -56,9 +54,14 @@ async fn handle_message(&mut self, ctx: &mut Context, msg: Routed<String>) -> Re
5654
In your console logs, you will see a line similar to:
5755

5856
```shell
59-
echo_service: My address on the hub is 0.d7234c4b
57+
echo_service: My address on the hub is d7234c4b
6058
```
6159

60+
## Using the forwarding address
61+
62+
Paste the forwarding address into the `echo_client`, as the destination service address. This will replace the `"echo_service"`
63+
address.
64+
6265
## Send a message to the forwarding address
6366

6467
The `echo_client` that you built in the previous example can be used to send messages to the forwarding address of the
@@ -94,9 +97,10 @@ impl Worker for EchoService {
9497

9598
async fn handle_message(&mut self, ctx: &mut Context, msg: Routed<String>) -> Result<()> {
9699
if &msg.as_str() == &"register" {
100+
let address = msg.reply().recipient().to_string();
97101
println!(
98102
"echo_service: My address on the hub is {}",
99-
msg.reply().recipient()
103+
address.strip_prefix("0:").unwrap()
100104
);
101105
Ok(())
102106
} else {

documentation/guides/rust/get-started/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ ockam = "0"
3030

3131
## Working with multiple binaries
3232

33-
Some of the Ockam examples need two programs. There are several ways you can configure your project to have multiple binaries.
33+
Some Ockam examples need two programs. There are several ways you can configure your project to have multiple binaries.
3434
The easiest way, and the way that we will use in this guide is to use the `examples` directory.
3535

3636
For example:
3737

3838
1. Create an `examples` directory.
39-
1. Create `client.rs` and `server.rs` source files in the `examples` directory.
40-
1. The programs can be executed using cargo: `cargo run --example server` and `cargo run --example client`.
39+
1. Create `echo_client.rs` and `echo_server.rs` source files in the `examples` directory.
40+
1. The programs can be executed using cargo: `cargo run --example echo_server` and `cargo run --example echo_client`.
4141

4242
Now we are ready to [Start building the Echo Service](../01-workers)

implementations/rust/ockam/ockam_examples/examples/step-4-server.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ impl Worker for EchoService {
2424

2525
async fn handle_message(&mut self, ctx: &mut Context, msg: Routed<String>) -> Result<()> {
2626
if &msg.as_str() == &"register" {
27+
let address = msg.reply().recipient().to_string();
2728
println!(
2829
"echo_service: My address on the hub is {}",
29-
msg.reply().recipient()
30+
address.strip_prefix("0:").unwrap()
3031
);
3132
Ok(())
3233
} else {

0 commit comments

Comments
 (0)