zocket 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,27 +3,3 @@
|
|
|
3
3
|
Zocket upgrades `orbz` Anchors into a hub-and-spoke network that communicates over WebSockets.
|
|
4
4
|
|
|
5
5
|
The package uses hub-spoke assumptions to make synchronization tractable, while providing small environment adapters for hubs and spokes on runtimes like Bun and the browser.
|
|
6
|
-
|
|
7
|
-
## Bun hub persistence
|
|
8
|
-
|
|
9
|
-
`createHub()` accepts Orbz Anchor persistence options and passes them through when it creates the hub anchor. For a one-file JSON store:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
import { createHub, createJsonFilePersistence } from "zocket/bun"
|
|
13
|
-
|
|
14
|
-
const persist = createJsonFilePersistence(new URL("./hub-state.json", import.meta.url))
|
|
15
|
-
const hub = await createHub({ routes, shapes, persist })
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
The JSON file stores route UUIDs and serialized Orb records in the same format the Anchor adapter reads back during hydration. For databases or split files, pass your own Anchor adapter instead:
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
const hub = await createHub({
|
|
22
|
-
routes,
|
|
23
|
-
shapes,
|
|
24
|
-
persist: {
|
|
25
|
-
adapter,
|
|
26
|
-
autosave: { intervalMs: 100 },
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
```
|