2.4.0 • Published 4 days ago

@threefold/grid_rmb_server v2.4.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 days ago

Twin server

Version Lint Build

Twin server is an RMB server that exposes the functionality of the grid client over RMB.

Prerequisites

Installation

External Package

yarn add @threefold/grid_rmb_server

Local Usage

  • Clone the repository
git clone https://github.com/threefoldtech/tfgrid-sdk-ts.git
  • Install it
yarn install

Configuration

Add network and account's mnemonics in config.json in server directory before running the server.

{
  "network": "<network environment dev, qa or test>",
  "mnemonic": "<your account mnemonics>",
  "storeSecret": "secret", // secret used for encrypting/decrypting the values in tfkvStore
  "keypairType": "sr25519" // keypair type for the account created on substrate
}

Life cycle

  • User from the outside sends an execution request(command with payload) to the RMB server.
  • RMB server puts this request in Redis.
  • Twin server checks if there is an execution request that its command is registered on the Twin server.
  • If this command is registered, the Twin server will pick up this request.
  • Twin server starts to execute it using the Grid3 client.
  • After finishing the execution, the Twin server puts the result back to Redis.
  • RMB keeps checking for the result is ready, and sends it back to the user once it's ready.

Running

Locally

yarn start

In External Package

yarn grid_rmb_server

You can also use another configuration file by using --config or -c option.

 yarn grid_rmb_server -c pathToConfigFile.json
 # or
 yarn grid_rmb_server --config pathToConfigFile.json

Usage

This is an example of getting user's contracts. Put the following content in a file test_contracts.ts

import { MessageBusClient } from "@threefold/rmb_peer_client";

async function main() {
  const myTwinId = 26;
  const cmd = "twinserver.contracts.listContractsByTwinId";
  const payload = JSON.stringify({ twinId: 26 });
  const rmb = new MessageBusClient();
  const requestId = await rmb.send(cmd, payload, myTwinId, 1);
  const result = await rmb.read(requestId, 1);
  console.log(result);
  rmb.disconnect();
}
main();

And then run this file by yarn run ts-node test_contracts.ts

see more examples in modules

2.4.0

4 days ago

2.4.0-rc2

9 days ago

2.4.0-rc1

18 days ago

2.3.5

2 months ago

2.3.4

2 months ago

2.3.2

2 months ago

2.3.3

2 months ago

2.3.1

2 months ago

2.3.0

2 months ago

2.3.0-rc4

2 months ago

2.3.0-rc2

2 months ago

2.3.0-rc3

2 months ago

2.3.0-rc1

2 months ago

2.3.0-alpha12

3 months ago

2.3.0-alpha11

3 months ago

2.3.0-alpha10

3 months ago

2.3.0-alpha9

3 months ago

2.3.0-alpha8

3 months ago

2.3.0-alpha7

4 months ago

2.3.0-alpha6

4 months ago

2.3.0-alpha5

4 months ago

2.3.0-alpha4

4 months ago

2.3.0-alpha3

4 months ago

2.2.0

5 months ago

2.3.0-alpha2

5 months ago

2.2.0-rc6

5 months ago

2.2.0-rc5

5 months ago

2.1.2

7 months ago

2.1.1

8 months ago

2.1.3

7 months ago

2.1.0

8 months ago

2.1.0-rc12

9 months ago

2.1.0-rc2

10 months ago

2.1.0-rc11

9 months ago

2.1.0-rc4

10 months ago

2.1.0-rc10

9 months ago

2.1.0-rc3

10 months ago

2.1.0-rc6

9 months ago

2.1.0-rc5

10 months ago

2.2.0-rc1

6 months ago

2.1.0-rc8

9 months ago

2.1.0-rc7

9 months ago

2.1.0-rc9

9 months ago

2.2.0-rc4

6 months ago

2.2.0-rc3

6 months ago

2.2.0-rc2

6 months ago

2.0.0

11 months ago

2.0.0-rc17

11 months ago

2.0.0-rc15

11 months ago

2.0.0-rc16

11 months ago

2.0.0-rc13

11 months ago

2.0.0-rc14

11 months ago

2.1.0-rc1

11 months ago

2.0.0-rc11

12 months ago

2.0.0-rc12

12 months ago

2.0.0-rc7

1 year ago

2.0.0-rc6

1 year ago

2.0.0-rc5

1 year ago

2.0.0-rc10

12 months ago

4.0.0-rc8.0

12 months ago

2.0.0-rc9

12 months ago

2.0.0-rc8

1 year ago

3.0.0-rc8.0

12 months ago

2.0.0-rc4

1 year ago

2.0.0-rc3

1 year ago

2.0.0-rc2

1 year ago

2.0.0-rc1

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago