Implement real-time sharing based on Automerge. #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
do not merge - this should stay on a branch. the purpose of the PR is just to gather feedback
I wrote this to get more insight into patterns that can be used for push and collaborative applications.
I've refactored the codebase to turn this into a real-time collaborative TODO app. The real-time infrastructure is based on Automerge - a JSON CRDT, using plain HTTP POST and EventSource for communication. To simplify some of the plumbing, I've introduced a small Automerge helper library.
This introduces some architectural changes:
There is no longer a HTTPTodoList, as HTTP is no longer used to
transport TODOs, but Automerge CRDT messages.
The DataBaseTodoList has also been removed, as its API no longer
made sense in the context of collaborative editing. It may be
reintroduced later.
MemoryTodoList is renamed to TodoList and is now part of the
application. There is one instance in each client, and one in the
server. Automerge takes care of synchronising them all.
The Cucumber step definitions have parameter types for the
context/action/outcome todo lists.
The scenarios have been changed to introduce people, allowing us
to express the collaborative nature of the application.