Skip to content

Receives a synchronization message from a peer and applies the changes to the local document. This updates both the document and the sync state to reflect the received changes.

Usage

am_sync_decode(doc, sync_state, message)

Arguments

doc

An Automerge document

sync_state

A sync state object (created with am_sync_state_new())

message

A raw vector containing an encoded sync message

Value

The document doc (invisibly, for chaining)

Examples

doc <- am_create()
sync_state <- am_sync_state_new()

# Receive message from peer
# message <- ... (received from network)
# am_sync_decode(doc, sync_state, message)