Sync Protocol
WebSocket-based sync on port 9090 for NodeDB-Lite clients. CRDT deltas flow between edge devices and Origin.
How It Works
- Lite client connects via WebSocket to Origin
- Client sends its current LSN watermark
- Origin sends any missed deltas since that watermark
- Client sends locally accumulated CRDT deltas
- Origin validates constraints (UNIQUE, FK, CHECK) via Raft
- Committed deltas are broadcast to all connected clients with matching shape subscriptions
Shape Subscriptions
Devices subscribe to a subset of data:
-- Client only receives data matching this filter
SUBSCRIBE SHAPE ON users WHERE user_id = $me;
Changes within a device's shape are pushed in real time. Changes outside the shape are not sent.
Compensation Hints
If a local write violates a constraint on Origin, a typed CompensationHint is sent back:
Rename— duplicate key detectedMerge— concurrent edits to the same documentCreateParent— FK target doesn't existAdjust— CHECK constraint violation
The application handles the conflict — no silent data loss.