Real-time Collaboration Module for Armature Framework
Provides CRDTs (Conflict-free Replicated Data Types) and collaboration primitives for building real-time collaborative applications.
Overview
┌─────────────────────────────────────────────────────────────────┐
│ Collaboration Architecture │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Client A │───▶│ CRDT │───▶│ Sync │◀───│ Client B │ │
│ └──────────┘ │ State │ │ Engine │ └──────────┘ │
│ └──────────┘ └──────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────┐ ┌──────────┐ │
│ │ Document │ │ Presence │ │
│ │ State │ │ State │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────────┘
Quick Start
use ;
// Create a collaborative document
let doc = new;
// Add a text field with CRDT
let text = doc.add_text;
// Make edits (automatically synced)
text.insert;
text.insert;
// Subscribe to changes
doc.on_change;
CRDT Types
| Type | Use Case | Merge Strategy |
|---|---|---|
LwwRegister |
Single values | Last-Writer-Wins |
GCounter |
Increment-only counters | Max per replica |
PnCounter |
Inc/dec counters | G-Counter pair |
GSet |
Append-only sets | Union |
OrSet |
Add/remove sets | Observed-Remove |
LwwMap |
Key-value stores | LWW per key |
RgaText |
Collaborative text | RGA algorithm |
Features
text- Text CRDT with RGA algorithm (default)websocket- WebSocket sync integrationfull- All features