Skip to content

Commit

Permalink
Fix steps in pub-sub readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DVaughan committed Jan 12, 2024
1 parent 456e1de commit a8d3a22
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions rust/pub-sub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,34 @@ dfx start --background
dfx deploy
```

### Step 3: Subscribe to the "Apples" topic:
### Step 3: Get the publisher ID

```
dfx canister call sub init '("Apples")'
dfx canister id publisher
```

### Step 4: Publish to the "Apples" topic:
### Step 4: Subscribe to the "Apples" topic:

```
dfx canister call pub publish '(record { "topic" = "Apples"; "value" = 2 })'
dfx canister call subscriber setup_subscribe '(principal "<publisher ID from Step 3>", "Apples")'
```

### Step 5: Receive your subscription:
### Step 5: Publish to the "Apples" topic:

```
dfx canister call sub getCount
dfx canister call publisher publish '(record { "topic" = "Apples"; "value" = 2 })'
```

### Step 6: Receive your subscription:

```
dfx canister call subscriber get_count
```

The output should resemble the following:

```
(2 : nat)
(2 : nat64)
```

## Security considerations and security best practices
Expand Down

0 comments on commit a8d3a22

Please sign in to comment.