mirror of https://github.com/status-im/js-waku.git
Add breakdown of what examples demonstrate
Also move explanation to each readme.
This commit is contained in:
parent
8a1babac6f
commit
2306bb1708
73
README.md
73
README.md
|
@ -300,77 +300,8 @@ For more general discussion and latest news, join #dappconnect on [Vac Discord](
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
## Web Chat App (ReactJS)
|
We have a number of code examples available,
|
||||||
|
you can find them in the [examples](https://github.com/status-im/js-waku/blob/main/examples/examples.md) directory.
|
||||||
A ReactJS chat app is provided as a showcase of the library used in the browser.
|
|
||||||
It implements [Waku v2 Toy Chat](https://rfc.vac.dev/spec/22/) protocol.
|
|
||||||
A deployed version is available at https://status-im.github.io/js-waku/.
|
|
||||||
|
|
||||||
Find the code in the [examples folder](https://github.com/status-im/js-waku/tree/main/examples/web-chat).
|
|
||||||
|
|
||||||
To run a development version locally, do:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
|
||||||
npm install # Install dependencies for js-waku
|
|
||||||
npm run build # Build js-waku
|
|
||||||
cd examples/web-chat
|
|
||||||
npm install # Install dependencies for the web app
|
|
||||||
npm run start # Start development server to serve the web app on http://localhost:3000/js-waku
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `/help` to see the available commands.
|
|
||||||
|
|
||||||
## CLI Chat App (NodeJS)
|
|
||||||
|
|
||||||
A node chat app is provided as a working example of the library.
|
|
||||||
It implements [Waku v2 Toy Chat](https://rfc.vac.dev/spec/22/) protocol.
|
|
||||||
|
|
||||||
Find the code in the [examples folder](https://github.com/status-im/js-waku/tree/main/examples/cli-chat).
|
|
||||||
|
|
||||||
To run the chat app, first ensure you have [Node.js](https://nodejs.org/en/) v14 or above:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
node --version
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, install and run:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
|
||||||
npm install # Install dependencies for js-waku
|
|
||||||
npm run build # Build js-waku
|
|
||||||
cd examples/cli-chat
|
|
||||||
npm install # Install dependencies for the cli app
|
|
||||||
npm run start -- --autoDial
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also specify an optional `listenAddr` parameter (.e.g `--listenAddr /ip4/0.0.0.0/tcp/7777/ws`).
|
|
||||||
This is only useful if you want a remote node to dial to your chat app,
|
|
||||||
it is not necessary in normal usage when you just connect to the fleet.
|
|
||||||
|
|
||||||
## Ethereum Direct Message
|
|
||||||
|
|
||||||
A PoC implementation of [20/ETH-DM](https://rfc.vac.dev/spec/20/).
|
|
||||||
|
|
||||||
Ethereum Direct Message, or Eth-DM, is a protocol that allows sending encrypted message to a recipient,
|
|
||||||
only knowing their Ethereum Address.
|
|
||||||
|
|
||||||
This is protocol has been created to demonstrated how encryption and signature could be added to messages
|
|
||||||
sent over the Waku v2 network.
|
|
||||||
|
|
||||||
The `main` branch's HEAD is deployed on GitHub Pages at https://status-im.github.io/js-waku/eth-dm/.
|
|
||||||
|
|
||||||
To run a development version locally, do:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
|
||||||
npm install # Install dependencies for js-waku
|
|
||||||
npm run build # Build js-waku
|
|
||||||
cd examples/eth-dm
|
|
||||||
npm install # Install dependencies for the web app
|
|
||||||
npm run start # Start development server to serve the web app on http://localhost:3000/js-waku/eth-dm
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,35 @@
|
||||||
# A NodeJS CLI Chat App powered by js-waku
|
# CLI Chat App
|
||||||
|
|
||||||
See js-waku [README](../../README.md#cli-chat-app-nodejs) for details.
|
**Demonstrates**:
|
||||||
|
|
||||||
|
- Group chat
|
||||||
|
- Node JS/TypeScript
|
||||||
|
- Waku Relay
|
||||||
|
- Waku Light Push
|
||||||
|
- Waku Store
|
||||||
|
|
||||||
|
A node chat app is provided as a working example of the library.
|
||||||
|
It implements [Waku v2 Toy Chat](https://rfc.vac.dev/spec/22/) protocol.
|
||||||
|
|
||||||
|
Find the code in the [examples folder](https://github.com/status-im/js-waku/tree/main/examples/cli-chat).
|
||||||
|
|
||||||
|
To run the chat app, first ensure you have [Node.js](https://nodejs.org/en/) v14 or above:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
node --version
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, install and run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
||||||
|
npm install # Install dependencies for js-waku
|
||||||
|
npm run build # Build js-waku
|
||||||
|
cd examples/cli-chat
|
||||||
|
npm install # Install dependencies for the cli app
|
||||||
|
npm run start -- --autoDial
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also specify an optional `listenAddr` parameter (.e.g `--listenAddr /ip4/0.0.0.0/tcp/7777/ws`).
|
||||||
|
This is only useful if you want a remote node to dial to your chat app,
|
||||||
|
it is not necessary in normal usage when you just connect to the fleet.
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
# Ethereum Direct Message Web App
|
# Ethereum Direct Message Web App
|
||||||
|
|
||||||
See js-waku [README](../../README.md#ethereum-direct-message) for details.
|
**Demonstrates**:
|
||||||
|
|
||||||
|
- Private Messaging
|
||||||
|
- React/TypeScript
|
||||||
|
- Waku Light Push
|
||||||
|
- Signature with Web3
|
||||||
|
- Asymmetric Encryption
|
||||||
|
|
||||||
|
A PoC implementation of [20/ETH-DM](https://rfc.vac.dev/spec/20/).
|
||||||
|
|
||||||
|
Ethereum Direct Message, or Eth-DM, is a protocol that allows sending encrypted message to a recipient,
|
||||||
|
only knowing their Ethereum Address.
|
||||||
|
|
||||||
|
This is protocol has been created to demonstrated how encryption and signature could be added to messages
|
||||||
|
sent over the Waku v2 network.
|
||||||
|
|
||||||
|
The `main` branch's HEAD is deployed on GitHub Pages at https://status-im.github.io/js-waku/eth-dm/.
|
||||||
|
|
||||||
|
To run a development version locally, do:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
||||||
|
npm install # Install dependencies for js-waku
|
||||||
|
npm run build # Build js-waku
|
||||||
|
cd examples/eth-dm
|
||||||
|
npm install # Install dependencies for the web app
|
||||||
|
npm run start # Start development server to serve the web app on http://localhost:3000/js-waku/eth-dm
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Here is the list of the code examples and the features they demonstrate:
|
||||||
|
|
||||||
|
- [Web Chat App](web-chat): Group chat, React/TypeScript, Relay, Store.
|
||||||
|
- [CLI Chat App](cli-chat): Group chat, Node JS/TypeScript, Relay, Light Push, Store.
|
||||||
|
- [Ethereum Direct Message Web App](eth-dm): Private Messaging, React/TypeScript, Light Push, Signature with Web3, Asymmetric Encryption.
|
||||||
|
- [Minimal JS Web Chat App](min-js-web-chat): Group chat, React/JavaScript, Relay, Protobuf using `protons`.
|
|
@ -1,70 +1,21 @@
|
||||||
# Getting Started with Create React App
|
# Minimal ReactJS Web Chat App
|
||||||
|
|
||||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
**Demonstrates**:
|
||||||
|
|
||||||
## Available Scripts
|
- Group chat
|
||||||
|
- React/JavaScript
|
||||||
|
- Waku Relay
|
||||||
|
- Protobuf using `protons`.
|
||||||
|
|
||||||
In the project directory, you can run:
|
A barebone chat app to illustrate the [ReactJS Relay guide](/guides/reactjs-relay.md).
|
||||||
|
|
||||||
### `yarn start`
|
To run a development version locally, do:
|
||||||
|
|
||||||
Runs the app in the development mode.\
|
```shell
|
||||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
||||||
|
npm install # Install dependencies for js-waku
|
||||||
The page will reload if you make edits.\
|
npm run build # Build js-waku
|
||||||
You will also see any lint errors in the console.
|
cd examples/min-js-web-chat
|
||||||
|
npm install # Install dependencies for the web app
|
||||||
### `yarn test`
|
npm run start # Start development server to serve the web app on http://localhost:3000/
|
||||||
|
```
|
||||||
Launches the test runner in the interactive watch mode.\
|
|
||||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
||||||
|
|
||||||
### `yarn build`
|
|
||||||
|
|
||||||
Builds the app for production to the `build` folder.\
|
|
||||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
||||||
|
|
||||||
The build is minified and the filenames include the hashes.\
|
|
||||||
Your app is ready to be deployed!
|
|
||||||
|
|
||||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
||||||
|
|
||||||
### `yarn eject`
|
|
||||||
|
|
||||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
||||||
|
|
||||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
||||||
|
|
||||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
||||||
|
|
||||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
||||||
|
|
||||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
||||||
|
|
||||||
### Code Splitting
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
||||||
|
|
||||||
### Analyzing the Bundle Size
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
||||||
|
|
||||||
### Making a Progressive Web App
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
||||||
|
|
||||||
### Advanced Configuration
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
||||||
|
|
||||||
### Deployment
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
||||||
|
|
||||||
### `yarn build` fails to minify
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
||||||
|
|
|
@ -1,3 +1,25 @@
|
||||||
# A React Web Chat App powered by js-waku
|
# Web Chat App
|
||||||
|
|
||||||
See js-waku [README](../../README.md#web-chat-app-reactjs) for details.
|
**Demonstrates**:
|
||||||
|
|
||||||
|
- Group chat
|
||||||
|
- React/TypeScript
|
||||||
|
- Waku Relay
|
||||||
|
- Waku Store
|
||||||
|
|
||||||
|
A ReactJS chat app is provided as a showcase of the library used in the browser.
|
||||||
|
It implements [Waku v2 Toy Chat](https://rfc.vac.dev/spec/22/) protocol.
|
||||||
|
A deployed version is available at https://status-im.github.io/js-waku/.
|
||||||
|
|
||||||
|
To run a development version locally, do:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/status-im/js-waku/ ; cd js-waku
|
||||||
|
npm install # Install dependencies for js-waku
|
||||||
|
npm run build # Build js-waku
|
||||||
|
cd examples/web-chat
|
||||||
|
npm install # Install dependencies for the web app
|
||||||
|
npm run start # Start development server to serve the web app on http://localhost:3000/js-waku
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `/help` to see the available commands.
|
||||||
|
|
|
@ -170,7 +170,7 @@ waku.relay.addObserver(processIncomingMessage, ['/relay-guide/1/chat/proto']);
|
||||||
|
|
||||||
That is it! Now, you know how to send and receive messages over Waku using the Waku Relay protocol.
|
That is it! Now, you know how to send and receive messages over Waku using the Waku Relay protocol.
|
||||||
|
|
||||||
Feel free to check out other [guides](menu.md) or [examples](../examples).
|
Feel free to check out other [guides](menu.md) or [examples](/examples/examples.md).
|
||||||
|
|
||||||
Here is the final code:
|
Here is the final code:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue