@automerge/automerge - v3.1.1
    Preparing search index...

    Function receiveSyncMessage

    • Update a document and our sync state on receiving a sync message

      Type Parameters

      • T

      Parameters

      • doc: Doc<T>

        The doc the sync message is about

      • inState: SyncState

        The SyncState for the peer we are communicating with

      • message: SyncMessage

        The message which was received

      • Optionalopts: ApplyOptions<T>

        Any ApplyOptions, used for passing a PatchCallback which will be informed of any changes in doc which occur because of the received sync message.

      Returns [Doc<T>, SyncState, null]

      An array of [newDoc, newSyncState, null] where newDoc is the updated state of doc, newSyncState should replace inState.

      Note that this function has three return values for legacy reasons. The third value used to be a sync message to send back but this is now always null and you should instead call generateSyncMessage after calling receiveSyncMessage to see if there are new messages to send.