rk_zenoh 0.2.2 copy "rk_zenoh: ^0.2.2" to clipboard
rk_zenoh: ^0.2.2 copied to clipboard

Dart bindings for Zenoh over a narrow C ABI - publish, subscribe and liveliness for offline-first fleets, with an explicit answer to the stale Zenoh ID after a restart.

example/example.md

Example #

A till announces that it is alive, listens for commands addressed to its durable name, and publishes a heartbeat. Nothing here runs on the calling isolate.

import 'dart:convert';

import 'package:rk_zenoh/rk_zenoh.dart';

Future<void> main() async {
  final session = await ZenohSession.open(ZenohConfig(
    mode: SessionMode.peer,
    connect: ['tcp/127.0.0.1:7447'],
  ));

  // Address by durable name, not by Zenoh ID: the ID changes on every
  // restart, and sending to the old one succeeds while delivering nothing.
  final alive = await session.declareLiveliness('telepos/alive/till-17');
  final orders = await session.subscribe('telepos/till/till-17/cmd');
  orders.samples.listen((s) => print('${s.key}: ${s.text}'));

  await session.put('telepos/shop/3/heartbeat', utf8.encode('ok'));

  await orders.close();
  await alive.close();
  await session.close();
}

example/rk_zenoh_example.dart is the runnable version: it stands a shop server and a till up in one process, restarts the till, and shows that addressing by durable identity survives the restart while addressing by the remembered Zenoh ID does not — and that the failure is silent.

cd rust && cargo build --release
dart run example/rk_zenoh_example.dart
0
likes
160
points
186
downloads

Documentation

API reference

Publisher

verified publisherspherex.kz

Weekly Downloads

Dart bindings for Zenoh over a narrow C ABI - publish, subscribe and liveliness for offline-first fleets, with an explicit answer to the stale Zenoh ID after a restart.

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

ffi

More

Packages that depend on rk_zenoh

Packages that implement rk_zenoh