@justtemporary/sync
v0.1.0
Published
High-level **client** library for TreeCRDT sync v0. It combines **`@justtemporary/discovery`** ([`packages/discovery`](../discovery), resolve a `docId` to a websocket URL), **`@justtemporary/sync-protocol`** ([`packages/sync-protocol/protocol`](../sync-pr
Downloads
24
Readme
@justtemporary/sync
High-level client library for TreeCRDT sync v0. It combines @justtemporary/discovery (packages/discovery, resolve a docId to a websocket URL), @justtemporary/sync-protocol (packages/sync-protocol/protocol, v0 SyncPeer, codecs, transports), and @justtemporary/sync-sqlite (packages/sync-protocol/material/sqlite, material layer → SyncBackend).
connectTreecrdtWebSocketSync needs a spec WebSocket client: the global in browsers, or webSocketCtor (e.g. import { WebSocket } from "undici") in Node. For a fully custom path, use createTreecrdtWebSocketSyncFromTransport, which only needs a DuplexTransport (no WebSocket).
When to use this package
- You want a single dependency to open a websocket to a sync server and run reconciliation against a SQLite-backed client store.
- You are fine with the built-in discovery + WebSocket + protobuf wiring.
When not to
- You only need the protocol types and
SyncPeer(use@justtemporary/sync-protocol). - You use a custom transport, no discovery, or an in-memory backend (depend on the protocol and/or
@justtemporary/discoveryas needed).
Repo location
- Source:
packages/treecrdt-syncin this monorepo. - Spec and layout: docs/ARCHITECTURE.md, docs/sync/v0.md.
Build
pnpm -C packages/treecrdt-sync run buildTest
pnpm -C packages/treecrdt-sync run testBuilds and tests assume sibling packages under packages/sync-protocol/ are available (workspace layout).
