2020-05-14 12:20:39 +00:00
|
|
|
# Fluence browser client
|
2020-12-28 14:39:06 +00:00
|
|
|
|
2020-12-30 10:14:24 +00:00
|
|
|
[![npm version](https://badge.fury.io/js/%40fluencelabs%2Ffluence.svg)](https://badge.fury.io/js/%40fluencelabs%2Ffluence)
|
2020-12-28 14:39:06 +00:00
|
|
|
|
2020-05-14 12:20:39 +00:00
|
|
|
Browser client for the Fluence network based on the js-libp2p.
|
|
|
|
|
|
|
|
## How to build
|
|
|
|
|
|
|
|
With `npm` installed building could be done as follows:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm install fluence
|
|
|
|
```
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
Shows how to register and call new service in Fluence network.
|
|
|
|
|
|
|
|
|
|
|
|
Generate new peer ids for clients.
|
|
|
|
```typescript
|
|
|
|
let peerId1 = await Fluence.generatePeerId();
|
|
|
|
let peerId2 = await Fluence.generatePeerId();
|
|
|
|
```
|
|
|
|
|
|
|
|
Establish connections to predefined nodes.
|
|
|
|
|
|
|
|
```typescript
|
2020-07-27 13:39:54 +00:00
|
|
|
let client1 = await Fluence.connect("/dns4/134.209.186.43/tcp/9003/ws/p2p/12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb", peerId1);
|
|
|
|
let client2 = await Fluence.connect("/ip4/134.209.186.43/tcp/9002/ws/p2p/12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er", peerId2);
|
2020-05-14 12:20:39 +00:00
|
|
|
```
|