#zenoh #zero #overhead #protocols #remote #typescript #future

zenoh-plugin-remote-api

Zenoh: The Zero Overhead Pub/Sub/Query Protocol

1 stable release

1.0.3 Nov 22, 2024

#82 in WebSocket

Download history 157/week @ 2024-11-18 312/week @ 2024-11-25

469 downloads per month

EPL-2.0 OR Apache-2.0

86KB
2K SLoC

Discussion Discord License License

Eclipse Zenoh

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.


Remote API Plugin

In Zenoh, the remote API plugin is an library loaded into a Zenohd instance at start up, which allows the creation of a Session, declaration of zenoh resources (Subscribers, Publishers, Queryables) remotely via websockets, for runtime environments where it is currently unsupported to run a zenoh binary. The Remote API was designed to support the Typescript Zenoh bindings, running in a browser.


Examples of usage

Prerequisites:

  • You have a zenoh router (zenohd) installed, and the libzenoh_plugin_remote_api.so library file is available in ~/.zenoh/lib or ~/target/debug.

Setup via a JSON5 configuration file

  • Create a zenoh.json5 configuration file containing for example:
    {
    mode: "router",
        plugins_loading: {
            enabled: true,
            search_dirs: ["./target/debug", "~/.zenoh/lib"],
        },
        plugins: {
            remote_api: {
                "websocket_port": "10000",
            },
        },
    }
    
    
  • Run the zenoh router with: zenohd -c EXAMPLE_CONFIG.json5

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 mantaining compatibility between the various git repositories in the Zenoh project.

At first, install Cargo and Rust. If you already have the Rust toolchain installed, make sure it is up-to-date with:

$ rustup update

⚠️ WARNING ⚠️ : As Rust doesn't have a stable ABI, the backend library should be built with the exact same Rust version than zenohd, and using for zenoh dependency the same version (or commit number) than 'zenohd'. Otherwise, incompatibilities in memory mapping of shared types between zenohd and the library can lead to a "SIGSEV" crash.

To know the Rust version you're zenohd has been built with, use the --version option.

Example with a downloaded zenohd:

$ zenohd --version
zenohd v1.0.0-beta.2 built with rustc 1.75.0 (82e1608df 2023-12-21)

Here, zenohd is version v1.0.0-beta.2 has been built with the rustc version 1.75.0.
Install and use this same toolchain with the following command:

$ rustup default 1.75.0

And edit the update Cargo.toml file to make all the zenoh dependencies to use the same version number:

zenoh = { version = "v1.0.0-beta.2", features = [ "unstable" ] }

Then build the plugin:

$ cargo build --release --all-targets -p zenoh-plugin-remote-api

Example with a version built from sources:

$ zenohd --version
zenohd v1.0.0-beta.2 built with rustc 1.75.0 (82e1608df 2023-12-21)

Here, zenohd version is v1.0.0-beta.2 where:

  • v1.0.0-beta.2 means it's a development version for the future v1.0.0 release
  • 82e1608df indicates the commit hash
  • And it has been built with the rustc version 1.75.0.
    Install and use this same toolchain with the following command:
$ rustup default 1.75.0

Dependencies

~31–44MB
~789K SLoC