GitBook: [2.0.0] 4 pages modified

This commit is contained in:
Evgeny Ponomarev 2021-08-11 13:46:24 +00:00 committed by gitbook-bot
parent 48572e1005
commit 617c3d3cd5
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
4 changed files with 21 additions and 19 deletions

View File

@ -17,13 +17,13 @@ npm start
Which opens a new tab in your browser at `http://localhost:3000`. Depending on your VSCode settings, you may have to confirm your choice.
The browser tab, representing the client peer, wants you to pick a relay node the browser client can connected to and, of course, allows the peer to respond to the browser client. Select any one of the offered relays:
The browser tab, representing the client peer, wants you to pick a relay node the browser client can connect to and, of course, allows the peer to respond to the browser client. Select any one of the offered relays:
![Relay Selection](../.gitbook/assets/image%20%2823%29.png)
The client peer is now connected to the relay and and ready for business:
The client peer is now connected to the relay and ready for business:
![Connection confirmation to network](../.gitbook/assets/image%20%2825%29.png)
@ -54,7 +54,7 @@ Which can now be imported into our `App.tsx` file:
![Import Aqua generated Typescript stub \(line 7\)](../.gitbook/assets/image%20%2826%29.png)
Lest it be overlooked, we wrote a little more than a handful of lines of code in Aqua and ended up with a deployment ready code block that includes both the network routing and compute logic to facilitate browser-to-browser messaging over a peer-to-peer network.
Lest it be overlooked, we wrote a little more than a handful of lines of code in Aqua and ended up with a deployment-ready code block that includes both the network routing and a compute logic to facilitate browser-to-browser messaging over a peer-to-peer network.
The local \(browser\) service `HelloPeer` is also implemented in the `App.tsx` file:

View File

@ -1,6 +1,6 @@
# 2. Hosted Services
In the previous example we used a local, browser-native service to facilitate the string generation and communication with another browser. The real power of the Fluence solution, however, is that services can be hosted one one or more nodes, easily reused and composed into decentralized applications with Aqua.
In the previous example, we used a local, browser-native service to facilitate the string generation and communication with another browser. The real power of the Fluence solution, however, is that services can be hosted on one or more nodes, easily reused and composed into decentralized applications with Aqua.
### Creating A Wasm Module
@ -10,7 +10,7 @@ In this section, we develop a simple `HelloWorld` service and host it on a peer-
Fluence hosted services are comprised of WebAssembly modules implemented in Rust and compiled to [wasm32-wasi](https://doc.rust-lang.org/stable/nightly-rustc/rustc_target/spec/wasm32_wasi/index.html). Let's have look at our code:
```text
```rust
// quickstart/2-hosted-services/src/main.rs
use marine_rs_sdk::marine;
use marine_rs_sdk::module_manifest;
@ -44,7 +44,7 @@ Aside from some housekeeping, the `build.sh` script gives the compile instructio
So far, so good. Of course, we want to test our code and we have a couple of test functions in our `main.rs` file:
```text
```rust
// quickstart/2-hosted-services/src/main.rs
use marine_rs_sdk::marine;
use marine_rs_sdk::module_manifest;
@ -85,7 +85,7 @@ mrepl configs/Config.toml
which puts us in the REPL:
```text
```bash
Welcome to the Marine REPL (version 0.8.0)
Minimal supported versions
sdk: 0.6.0
@ -125,7 +125,7 @@ marine aqua artifacts/hello_world.wasm
Which gives us the Aqua-ready interfaces:
```text
```haskell
data HelloWorld:
msg: string
reply: string
@ -162,7 +162,7 @@ Which gets us a list of network peers:
Let's use the peer`12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi` as our deployment target and deploy our service from the VSCode terminal. In the `quickstart/2-hosted-services` directory run:
```text
```bash
fldist --node-id 12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi \
new_service \
--ms artifacts/hello_world.wasm:configs/hello_world_cfg.json \
@ -176,7 +176,7 @@ service id: 1e740ce4-81f6-4dd4-9bed-8d86e9c2fa50
service created successfully
```
Take note of the service id, `1e740ce4-81f6-4dd4-9bed-8d86e9c2fa50` in this examples but different for you, as we need it to use the service with Aqua.
Take note of the service id, `1e740ce4-81f6-4dd4-9bed-8d86e9c2fa50` in this example but different for you, as we need it to use the service with Aqua.
Congratulations, we just deployed our first reusable service to the Fluence network and we can admire our handiwork on the Fluence [Developer Hub](https://dash.fluence.dev/):

View File

@ -14,7 +14,7 @@ And run the application with:
npm start
```
Which will open a new browser tab at `http://localhost:3000` . Following the instructions we connect to any one of the displayed relay ids, open another browser tab also at `http://localhost:3000`, select a relay and copy and paste the client peer id and relay id into corresponding fields in the first tab and press the `say hello` button.
Which will open a new browser tab at `http://localhost:3000` . Following the instructions, we connect to any one of the displayed relay ids, open another browser tab also at `http://localhost:3000`, select a relay and copy and paste the client peer id and relay id into corresponding fields in the first tab and press the `say hello` button.
![Browser To Service Implementation](../.gitbook/assets/image%20%2853%29.png)
@ -24,7 +24,7 @@ The result looks familiar, so what's different ? Let's have a look at the Aqua f
And let's work it from the top:
* Import the the Aqua standard library \(1\)
* Import the Aqua standard library \(1\)
* Provide the hosted service peer id \(3\) and service id \(4\)
* Specify the `HelloWorld` struct interface binding \(6-8\) for the hosted service from the `marine aqua` export
* Specify the `HelloWorld` interface and function binding \(11-12\) for the hosted service from the `marine aqua` export
@ -41,5 +41,5 @@ Before we dive into the `sayHelo` function, let's look at why we still need a lo
A little more involved than our first example but we are again getting a lot done with very little code. Of course, there could be more than one hosted service in play and we could implement, for example, hosted spell checking, text formatting and so much more without much extra effort to express additional workflow logic in our Aqua script.
This brings us to the end of this quick start tutorial. We hope you are as exited as we are to put Aqua and the Fluence stack to work. To continue your Fluence journey, have a look at the remainder of this book, take a deep dive into Aqua with the [Aqua book](https://doc.fluence.dev/aqua-book/) or dig into Marine and Aqua examples in the [repo](https://github.com/fluencelabs/examples).
This brings us to the end of this quick start tutorial. We hope you are as excited as we are to put Aqua and the Fluence stack to work. To continue your Fluence journey, have a look at the remainder of this book, take a deep dive into Aqua with the [Aqua book](https://doc.fluence.dev/aqua-book/) or dig into Marine and Aqua examples in the [repo](https://github.com/fluencelabs/examples).

View File

@ -4,7 +4,7 @@ Welcome to our quick-start tutorials which guide you through the necessary steps
1. Create a browser-to-browser messaging web application
2. Create and deploy a hosted service
3. Create a browser-to-service messaging web application
3. Enhance a browser-to-browser application with a network-hosted service
For your development convenience, Fluence provides a [docker-based development environment](https://github.com/fluencelabs/devcontainer) that comes with the necessary dependencies, tooling and quick-start code pre-installed.
@ -19,7 +19,7 @@ Fluence's devcontainer is a ready to use dockerized development environment with
### How to install
Docker and optionally VSCode need to be available on your system. For Docker installation, follow the [Get Docker](https://docs.docker.com/get-docker/) instructions for your OS. For VSCode, see [VSCocde](https://code.visualstudio.com/) for instructions.
Docker and optionally VSCode need to be available on your system. For Docker installation, follow the [Get Docker](https://docs.docker.com/get-docker/) instructions for your OS. For VSCode, see [VSCode](https://code.visualstudio.com/) for instructions.
With Docker and VSCode in place:
@ -47,3 +47,5 @@ Congratulations, you now have a fully functional Fluence development environment
If you encounter any problems or have suggestions, please open an issue or submit a PR. You can also reach out in [Discord](https://fluence.chat) or [Telegram](https://t.me/fluence_project). For more detailed reference resources, see the [Fluence documentation](https://doc.fluence.dev/docs/) and [Aqua book](https://doc.fluence.dev/aqua-book/).
All right, now we are ready to proceed to the first application on Fluence.