Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
got it working
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed May 16, 2024
1 parent fcd1b9e commit 5edbd85
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/server/sync_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ async function write(text: string) {
}
}

console.log('syncing replica with peer');
const peer = new Earthstar.Peer();
peer.addReplica(replica);
peer.sync("http://localhost:8000", true);
console.log('synced; writing');
write("Hello, world!");

console.log('listening for chat messages');
const cache = new Earthstar.ReplicaCache(replica);
cache.onCacheUpdated(() => {
Expand All @@ -62,4 +55,16 @@ cache.onCacheUpdated(() => {
console.log(doc.text);
}
});
console.log('done');

console.log('syncing replica with peer');
const peer = new Earthstar.Peer();
peer.addReplica(replica);
const syncer = peer.sync("http://localhost:8000");
await syncer.isDone();
console.log('synced; writing');
write("Hello, world!");
// console.log(replica);

console.log('done');
// FIXME: ...
cache.queryDocs();

0 comments on commit 5edbd85

Please sign in to comment.