Wire API

The Wire API is the lower level API the Holster API is built on. It works directly with the graph format that's stored on disk and sent between devices over WebSockets, and it's available via holster.wire.

Most applications don't need it. Use it when you want full control over node ids and state, or to see exactly what Holster sends and stores.

Compared to the Holster API

Holster API

Wire API

Keys are chained with get() and next().

Requests name a node id directly, with a lex query.

Nested objects are stored as nodes for you.

You write each node yourself, with references between them.

put() sets the state of each value for you.

You provide the state of every property you write.

Returns plain data.

Returns graph data, including each node's metadata.

The Holster API stores top level keys on a node with the id "root", so these two requests read the same value:

const value = await holster.get("key")

holster.wire.get({"#": "root", ".": "key"}, msg => {
  console.log(msg.put.root.key)
})

The Wire API takes callbacks rather than returning promises.

The examples folder compares the same requests made with the Holster API and the Wire API.