tweaks/fixes

This commit is contained in:
dmc
2024-01-10 15:19:00 +01:00
parent 9785189c9f
commit 52942669af
2 changed files with 9 additions and 9 deletions

View File

@@ -116,9 +116,9 @@ After running with `pear dev` it should look like this:
Our app is going to use these modules: Our app is going to use these modules:
- [hyperswarm](https://www.npmjs.com/package/hyperswarm). One of the main building blocks. Find peers that share a "topic". - [hyperswarm](https://www.npmjs.com/package/hyperswarm) - Find peers that share a "topic". An essential building block.
- [hypercore-crypto](https://www.npmjs.com/package/hypercore-crypto). A set of crypto functions. - [hypercore-crypto](https://www.npmjs.com/package/hypercore-crypto) - A set of crypto functions.
- [b4a](https://www.npmjs.com/package/b4a). A set of functions for bridging the gap between the Node.js `Buffer` class and the `Uint8Array` class. - [b4a](https://www.npmjs.com/package/b4a) - A set of functions for bridging the gap between the Node.js `Buffer` class and the `Uint8Array` class.
The dependencies can be installed with the following command: The dependencies can be installed with the following command:
@@ -222,13 +222,13 @@ In the first app, click on `Create chat room`. Once the app has started the topi
Paste the topic from the first app into the input of the second app and then click on `Join chat room`. Paste the topic from the first app into the input of the second app and then click on `Join chat room`.
<p align="center"> <p align="center">
<img src="./assets/chat-app-4a.png" alt="The first app, with the topic"> <img src="../assets/chat-app-4b.png" alt="Second app, using topic from the first"> <img src="../assets/chat-app-4a.png" alt="The first app, with the topic"> <img src="../assets/chat-app-4b.png" alt="Second app, using topic from the first">
</p> </p>
Once connected messages can be sent between the applications. Once connected messages can be sent between the applications.
<p align="center"> <p align="center">
<img src="./assets/chat-app-5a.png" alt="View from the first app"> <img src="../assets/chat-app-5b.png" alt="View from the second app"> <img src="../assets/chat-app-5a.png" alt="View from the first app"> <img src="../assets/chat-app-5b.png" alt="View from the second app">
</p> </p>
@@ -236,9 +236,9 @@ Once connected messages can be sent between the applications.
In a traditional client-server setup the server is hosted at an IP address (or hostname) and a port, e.g. `http://localhost:3000`. This is what clients use to connect to the server. In a traditional client-server setup the server is hosted at an IP address (or hostname) and a port, e.g. `http://localhost:3000`. This is what clients use to connect to the server.
The code in `app.js` contains the line `swarm.join(topicBuffer, { client: true, server: true })`. Here `topicBuffer` is a 32 byte string. The creator of a chat room will generate a random byte string which acts as a room invinitation. Any peers with this invite (the topic) can use it to message to all other peers with the invite. Note also that both applications behave the same way, neither is only a client and neither is only a server. The code in `app.js` contains the line `swarm.join(topicBuffer, { client: true, server: true })`. Here `topicBuffer` is a 32 byte string. The creator of a chat room will generate a random byte string which acts as a room invinitation. Any peers with this invite (the topic) can use it to message all other peers with the invite. Note also that both applications behave the same way, neither is only a client and neither is only a server.
Applications join and leave topics so if the peer who created the topic/invite goes offline or even leaves the topic this has no effect on functionality. Applications join and leave topics, so if the peer who created the topic/invite goes offline or even leaves the topic this has no effect on functionality.
Two application instances are running on the same machine, connecting over a Distributed Hash Table (DHT) via `hyperswarm`. Two application instances are running on the same machine, connecting over a Distributed Hash Table (DHT) via `hyperswarm`.

View File

@@ -1,6 +1,6 @@
# Starting a Pear Desktop Project # Starting a Pear Desktop Project
In preparation for [Making a Pear Application](./making-a-pear-app.md) the following steps outline how to generate, configure, and develop a Pear Desktop Project. In preparation for [Making a Pear Desktop Application](./making-a-pear-desktop-app.md) the following steps outline how to generate, configure, and develop a Pear Desktop Project.
## Step 1. Initialization ## Step 1. Initialization
@@ -75,4 +75,4 @@ See the [Configuration Documentation](../reference/configuration.md) for all con
## Next ## Next
* [Making a Pear Application](./making-a-pear-app.md). * [Making a Pear Desktop Application](./making-a-pear-desktop-app.md)