Skip to content

ZettaScaleLabs/zenoh-typescript

Repository files navigation

⚠️ This is a WIP Active development project: Experiment with with it, but it is Not production Ready!

Discord License

Eclipse Zenoh Typescript / Javascript API

The Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.

Zenoh (pronounce /zeno/) unifies data in motion, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.

Check the website zenoh.io and the roadmap for more detailed information.


Typescript/Javascript API

This repository provides a Typscript / Javascript binding through the use of the remote-api-plugin in this repo. The long term plan is to use zenoh Zenoh written in Rust to target WASM.
In its current state, it is not possible to compile Zenoh (Rust) to target WASM, and will need to undergo a fair amount of refactoring before that can happen.


How to build it

⚠️ WARNING ⚠️ : Zenoh and its ecosystem are under active development. When you build from git, make sure you also build from git any other Zenoh repository you plan to use (e.g. binding, plugin, backend, etc.). It may happen that some changes in git are not compatible with the most recent packaged Zenoh release (e.g. deb, docker, pip). We put particular effort in maintaining compatibility between the various git repositories in the Zenoh project.

Building the Typescript project

  1. Make sure that the following utilities are available on your platform.
  1. Navigate to the directory zenoh-ts

  2. Run the commands:

  yarn install 
  # 
  yarn run build

Building the Rust Plugin

  1. Make sure that the following utilities are available on your platform.
  1. Navigate to zenoh-plugin-remote-api

  2. Run cargo build

Examples of usage

Running the Rust Plugin

Prerequisites:

  • You have a zenoh router (zenohd) installed, and the zenoh_plugin_remote_api library file is available in ~/.zenoh/lib.

Setup via a JSON5 configuration file

  • Create a zenoh.json5 configuration file containing for example:
    {
      plugins: {
        // configuration of "storage_manager" plugin:
        remote_api: {
          "websocket_port": "10000",
          // secure_websocket configuration is optional
          "secure_websocket": {
                "certificate_path" : "/path/to/certificate",
                "private_key_path" : "/path/to/private_key"
          }
        }
        // Optionally, add the REST plugin
        rest: { http_port: 8000 }
      }
    }
  • Run the zenoh router with: zenohd -c zenoh.json5

Adding Typescript to your application

The TypeScript library can be install from the command line:

npm install @zettascalelabs/[email protected]

Or added via package.json

"@zettascalelabs/zenoh-ts": "0.0.6"

Note: In order to add this library to your project you must log into the github npm repository,
please refer to this link for more information Accessing github NPM