Skip to content

Commit d9e8127

Browse files
Update README.md
1 parent 237c6cf commit d9e8127

File tree

1 file changed

+8
-46
lines changed

1 file changed

+8
-46
lines changed

motoko/pub-sub/README.md

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,20 @@ This sample project demonstrates how functions may be passed as arguments of int
44

55
A common problem in both distributed and decentralized systems is keeping separate services (or canisters) synchronized with one another. While there are many potential solutions to this problem, a popular one is the publisher/subscriber pattern or "PubSub". PubSub is an especially valuable pattern on the Internet Computer as its primary drawback, message delivery failures, does not apply.
66

7-
## Prerequisites
8-
This example requires an installation of:
7+
## Deploying from ICP Ninja
98

10-
- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx).
11-
- [x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
9+
[![](https://icp.ninja/assets/open.svg)](https://icp.ninja/editor?g=https://github.com/dfinity/examples/tree/master/motoko/pub-sub)
1210

13-
Begin by opening a terminal window.
11+
## Build and deploy from the command-line
1412

15-
## Step 1: Setup the project environment
13+
### 1. [Download and install the IC SDK.](https://internetcomputer.org/docs/building-apps/getting-started/install)
1614

17-
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
15+
### 2. Download your project from ICP Ninja using the 'Download files' button on the upper left corner, or [clone the GitHub examples repository.](https://github.com/dfinity/examples/)
1816

19-
```bash
20-
cd examples/motoko/pub-sub
21-
dfx start --background
22-
```
17+
### 3. Navigate into the project's directory.
2318

24-
## Step 2: Deploy the canisters:
25-
26-
```bash
27-
dfx deploy
28-
```
29-
30-
## Step 3: Subscribe to the "Apples" topic
31-
32-
```bash
33-
dfx canister call sub init '("Apples")'
34-
```
35-
36-
## Step 4: Publish to the "Apples" topic
37-
38-
```bash
39-
dfx canister call pub publish '(record { "topic" = "Apples"; "value" = 2 })'
40-
```
41-
42-
## Step 5: Receive your subscription
43-
44-
```bash
45-
dfx canister call sub getCount
46-
```
47-
48-
The output should resemble the following:
49-
50-
```bash
51-
(2 : nat)
52-
```
19+
### 4. Run `dfx start --background --clean && dfx deploy` to deploy the project to your local environment.
5320

5421
## Security considerations and best practices
5522

56-
If you base your application on this example, we recommend you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/current/references/security/) for developing on the Internet Computer. This example may not implement all the best practices.
57-
58-
For example, the following aspects are particularly relevant for this app, since it makes inter-canister calls:
59-
* [Be aware that state may change during inter-canister calls.](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/overview)
60-
* [Only make inter-canister calls to trustworthy canisters.](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/overview)
61-
* [Don’t panic after await and don’t lock shared resources across await boundaries.](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/overview)
23+
If you base your application on this example, it is recommended that you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/building-apps/security/overview) for developing on ICP. This example may not implement all the best practices.

0 commit comments

Comments
 (0)