A WebSocket-based synchronization server for Automerge documents, compatible with the automerge-repo protocol used by sync.automerge.org. Enables R to serve as a sync hub for JavaScript, Rust, and other Automerge clients in collaborative applications.
Main Functions
amsync_server()Create a new sync server with
$start()and$stop()methods
Document Management
create_document()Create a new document
get_document()Retrieve a document by ID
list_documents()List all document IDs
generate_document_id()Generate a new document ID
Protocol
The server implements the automerge-repo sync protocol over WebSockets. Messages are CBOR-encoded and include:
- join/peer
Handshake messages for connection establishment
- request/sync
Document synchronization messages
- ephemeral
Transient messages forwarded without persistence
- error
Error notifications
Example
# Create and start a server
server <- amsync_server(port = 3030)
server$start()
# Stop when done
server$stop()Author
Maintainer: Charlie Gao charlie.gao@posit.co (ORCID)
Other contributors:
Posit Software, PBC (ROR) [copyright holder, funder]