Skip to content

Instantly share code, notes, and snippets.

View dan-weaver's full-sized avatar

Dan Weaver dan-weaver

View GitHub Profile
/*
Create two peers, each with one Automerge doc
peer2's doc is a clone of peer1's to ensure common history
Each peer has a syncState representing the estimated state of the other peer
Each peer has a FIFO list "inbox" emulating a network transport
Every 500ms, simulate the network for each peer in turn, via update():
- check for any messages in the peer's inbox
- call Automerge.receiveSyncMessage for each message
- and update doc & sync accordingly

Keybase proof

I hereby claim:

  • I am dan-weaver on github.
  • I am dan_weaver (https://keybase.io/dan_weaver) on keybase.
  • I have a public key ASAOCQyqM22WX5KllW1l9-8hp8lELxReo4o_FUxTioUgqQo

To claim this, I am signing this object: