5 releases

0.5.4 Jul 11, 2021
0.5.3 Jul 4, 2021
0.5.2 Jun 20, 2021
0.5.1 Jun 13, 2021
0.5.0 Jun 11, 2021

#268 in Network programming

25 downloads per month

MIT license



Convenient data-object sharing library.

Are you tired of handling all the little details of propagating object states? Computing differences, serialization, network propagation (timeouts, keep-alives, ...), somehow catching-up on reconnection, load balancing object production, event delivery, object lifetime control etc. Hakuban does all of that for you.

For details on structs, modules, cargo feature flags, event handling, etc. head on to documentation.

If you feel you may need something slightly different, there is a list of similar projects at the end of this document.


Some of Hakuban's features and properties:

  • Only the difference is propagated over the network when an object changes. Compressed by default.
  • Automatically handles re-synchronization on connection loss and regain.
  • Object identifiers are "rich" (json), not just strings. So, for example, complex user-defined search filter on a web page, expressed as json, can directly act as an identifier of the object holding results of that search.
  • Object can belong to zero or more tags, which function as wildcards for exposing or observing unknown objects.
  • Supports tree network topology, with leafs happily unaware of anything not relevant to them.
  • Nodes on all levels can observe and expose alike, unlike in most database/graphql-centric solutions.
  • At most one exposer is selected for each object to keep it up to date. With load balancing.
  • Thread-safe core, works with async and sync code, delivers events as streams, iterators or callbacks.
  • Core is not bound to any specific async-runtime. First implemented network transport uses websockets on tokio.
  • Allows use of custom de/serializers, uses serde by default.
  • Can be compiled to .so, has ruby binding (ffi), and wasm binding in the near future.

It's not meant for and won't do: message passing, remote function calls, synchronous "calls" (request-response), allow explicit target addressing, be a work-queue, allow "consuming" objects, work directly with any database.

Usage example

let hakuban = hakuban::LocalNode::builder().build();
let observe = hakuban.object((["some-tag"],"xxx")).observe::<String>();

std::thread::spawn(move || {
	let expose = hakuban.object((["some-tag"],"xxx")).expose();

for _event in observe.changes() {
	if let Some(data) = observe.object_data()? {
		println!("{}", data);

For more examples check out the examples directory, and documentation.

Related projects

Ruby binding

Hakuban ruby ffi binding.

Hakuban webapp router

(TODO: add url)

Webapp router, with following properties:

  • Every link is open-in-new-tab compatible, and copy-link compatible
  • Short urls, optionally exposing selected state variables
  • All urls are shareable
  • State can be bigger than what fits in a url (as long as it's built progresively)
  • Works while offline/disconnected (no url shortening then)


(TODO: add url)

Task queue/scheduler. Aware of resource preparation time. Resources owned and resources required by task are graph-structured.


(TODO: add url)

Commercial (aka. shameless plug) robotic ui-testing platform.


Not ordered by priority:

  • wasm binding
  • preloading/side loading
  • avoid object flicker on short disconnections
  • message filter for auth* and auditing
  • make event pipeline elements destructible
  • expose introspection/statistics objects


Distributed under the MIT License. See LICENSE for more information.


To get help, praise the author(s), laugh at problems of others, or just hang around observing progress - join hakuban's matrix channel #hakuban:matrix.org

If you're looking for more intimate contact, talk to yunta - on matrix @yunta:mikoton.com, or email yunta@mikoton.com.

Similar projects

The list does not contain change- or message- focused projects, nor projects with integrated database. Hopefully. It's surprisingly difficult to figure out what some of those actually do:


~156K SLoC