2.7.1 • Published 4 months ago

@threefold/rmb_peer_client v2.7.1

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

RMB Peer Client

Version Lint Build

The RMB Peer Client is a TypeScript library that enables communication with the ThreeFold Messaging Bus (RMB). It provides functionalities similar to the Rust client.

Usage

To use the RMB Peer Client, instantiate the MessageBusClient class:

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

const messageBus = new MessageBusClient();

You can send messages over the RMB using the send method, which takes the following parameters:

  1. requestCommand The command to be executed in the Zero-OS node.
  2. requestData The message content.
  3. destinationTwinId The ID of the destination twin to receive the message.
  4. expirationMinutes Expiration time for the message in minutes.
const requestId = await messageBus.send("zos.nodes.list", "", 143, 5);

After sending a message, you can read the response using the read method:

const response = await messageBus.read(requestId);

Installation

Install the package via npm:

npm install @threefold/rmb_peer_client

Example

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

const messageBus = new MessageBusClient();

// Send a message
const requestId = await messageBus.send("zos.nodes.list", "", 143, 5);

// Read the response
const response = await messageBus.read(requestId);

API

MessageBusClient()

  • Constructor function to create a new instance of the RMB Peer Client.
  • Accepts an optional port parameter to specify the Redis server port. Defaults to 6379.

send(requestCommand: string, requestData: string, destinationTwinId: number, expirationMinutes: number): Promise<string>

  • Method to send a message over the RMB.
  • Returns a promise that resolves to the request ID.

read(requestId: string, timeoutMinutes = 1): Promise<unknown>

  • Method to read the response for a specific request ID.
  • Accepts an optional timeoutMinutes parameter to specify the timeout duration for waiting for the response.
  • Returns a promise that resolves to the response data.

Requirements

  • Redis server running locally or on a specified host/port.
2.7.0

4 months ago

2.7.1

4 months ago

2.7.0-rc3

4 months ago

2.7.0-rc2

5 months ago

2.7.0-rc1

6 months ago

2.6.4

6 months ago

2.6.3

7 months ago

2.6.2

7 months ago

2.6.1

7 months ago

2.6.0

8 months ago

2.6.0-rc4

8 months ago

2.6.0-rc3

8 months ago

2.6.0-rc1

8 months ago

2.6.0-rc2

8 months ago

2.5.0-rc1

1 year ago

2.5.0-rc2

1 year ago

2.4.3

1 year ago

2.5.0-rc3

1 year ago

2.5.0

1 year ago

2.5.2

12 months ago

2.5.1

1 year ago

2.4.2

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

2.4.0-rc2

1 year ago

2.4.0-rc1

1 year ago

2.3.5

1 year ago

2.3.4

1 year ago

2.3.2

1 year ago

2.3.3

1 year ago

2.3.1

1 year ago

2.3.0

1 year ago

2.3.0-rc4

1 year ago

2.3.0-rc2

1 year ago

2.3.0-rc3

1 year ago

2.3.0-rc1

1 year ago

2.3.0-alpha12

1 year ago

2.3.0-alpha11

1 year ago

2.3.0-alpha10

1 year ago

2.3.0-alpha9

1 year ago

2.3.0-alpha8

1 year ago

2.3.0-alpha7

1 year ago

2.3.0-alpha6

2 years ago

2.3.0-alpha5

2 years ago

2.3.0-alpha4

2 years ago

2.3.0-alpha3

2 years ago

2.2.0

2 years ago

2.3.0-alpha2

2 years ago

2.3.0-alpha1

2 years ago

2.2.0-rc6

2 years ago

2.2.0-rc5

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.3

2 years ago

2.1.0

2 years ago

2.1.0-rc12

2 years ago

2.1.0-rc2

2 years ago

2.1.0-rc11

2 years ago

2.1.0-rc4

2 years ago

2.1.0-rc10

2 years ago

2.1.0-rc3

2 years ago

2.1.0-rc6

2 years ago

2.1.0-rc5

2 years ago

2.2.0-rc1

2 years ago

2.1.0-rc8

2 years ago

2.1.0-rc7

2 years ago

2.1.0-rc9

2 years ago

2.2.0-rc4

2 years ago

2.2.0-rc3

2 years ago

2.2.0-rc2

2 years ago

2.0.0

2 years ago

2.0.0-rc17

2 years ago

2.0.0-rc15

2 years ago

2.0.0-rc16

2 years ago

2.0.0-rc13

2 years ago

2.0.0-rc14

2 years ago

2.1.0-rc1

2 years ago

2.0.0-rc11

2 years ago

2.0.0-rc12

2 years ago

2.0.0-rc7

2 years ago

2.0.0-rc6

2 years ago

2.0.0-rc5

2 years ago

2.0.0-rc10

2 years ago

4.0.0-rc8.0

2 years ago

2.0.0-rc9

2 years ago

2.0.0-rc8

2 years ago

3.0.0-rc8.0

2 years ago

2.0.0-rc4

2 years ago

2.0.0-rc3

2 years ago

2.0.0-rc2

2 years ago

2.0.0-rc1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago