Fluence Network

The Fluence Labs Developer Hub

Welcome to the Fluence Labs developer hub. You'll find comprehensive guides and documentation to help you start working with Fluence Labs as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    API Reference

Debugging

Debugging with a local Fluence node

Keep your write-test-fix cycle short by debugging your application locally, without waiting for deployment and network.

Requirements

You will need Docker installed.

How To

Note

For this guide, you will need compiled Wasm code. Please read here to learn about compilation to Wasm.

Start your application

Run the following command in terminal, it will start your application in a Docker container (remember to use an absolute path to your .wasm file):

docker run --rm -v /path/to/your/code.wasm:/code/code.wasm -p 30000:30000 fluencelabs/frun

To connect to your application from JS client use directConnect method:

import * as fluence from "fluence";
...
let appId = 1
fluence.directConnect("localhost", 30000, appId);

appId could be any number. You do not need to specify the correct appId for local testing.

Note

Use connect method instead of directConnect for an application deployed in the Fluence network. Read here to learn how to interact with deployed applications.

Send request let request = session.request("Fluence") to hello-world app through JavaScript client and we can see in docker logs:

[Mon Apr 22 16:03:31 MSK 2019, info, Main$] Tx request. appId: 1
[Mon Apr 22 16:03:31 MSK 2019, info, Main$] Tx: 'Fluence'
INFO  [hello_world2_2018] Fluence has been successfully greeted

Tx: 'Fluence' is our request, INFO [hello_world2_2018] Fluence has been successfully greeted log from code. How to write logs from the code you can see in backend guides.

After this get response request.result(). And we will see the result:

[Mon Apr 22 16:03:31 MSK 2019, info, Main$] Query request. appId: 1, path: sessionId/0, data: Some()
[Mon Apr 22 16:03:31 MSK 2019, info, TxProcessor] Queried result: Hello, world! From user Fluence

Note

You can also send requests from the command line with curl, read here for more.

Debugging


Debugging with a local Fluence node

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.