Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix instructional steps in pub-sub readme.md #641

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading