IMPORTANT: Client and README are under heavy development and can be outdated. Ask a question in gitter or file an issue.
Browser client simplifies interaction with the real-time cluster for a user. It has zero dependencies and can be added to other code. Developers can deploy their backend code to Fluence network and built a web3 application based on Fluence Client to interact with this backend code. It is written on TypeScript to reach more clean, understandable and typesafe code with good reusability.
npm install js-fluence-client
You need to have a deployed real-time cluster.
You can use this part of project to deploy 4-nodes cluster with
multiply functions as an example.
TODO: HOWTO deploy custom code (link to some other readme)
Init client and session
For interaction with the default
increment and multiply cluster you can use
If we have a local cluster, we can initialize client like this:
Than we can use built-in functions:
// mutate state but returns nothingclient.incrementCounter;// get result after counter;console.logJSON.stringifycounter;// get result of moltiplying;// should be 13268console.logJSON.stringifyres;
If you deployed your own code, you can use
;// will return some result based on logic of deployed code;
If you want to write your own library, you can use
IncrementAndMultiply.ts as a basis:
You can find other examples in the examples folder.