Add distributed real-time state replication for apps
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Implement a distributed real-time state system for apps, using CRDT (e.g. https://github.com/yjs/yjs), receive updates via websockets.
Example implementation:
- When a first user opens an app, a CRDT object is created on the server which is also sent to the user
- If this users performs modifications, updates are sent to the CRDT via websockets
- If other users join, they receive the CRDT of the state at the moment they request it (w.r.t other users)
- All users receive the modifications from other users through websockets, and send their own
- The websockets also implements a keepalive mechanism. If all users have left, the server CRDT is destroyed.
Potential issues (not exhaustive):
- When a user performs modification, should we implement optimistic updates at the local client-side level, and then reconcile with what the server sends (it could be difficult, since they could be out of order wrt to what the server receives)? Or should the user wait for the modification to make a roundtrip to the server, which then modifies the global state (e.g. what is done in some video games), and sent back to them?
- Between the moment a user initiates the request to get its copy of the CRDT and when they actually receive it, the delay may be arbitrary long (e.g. bad connection), while other users are still modifying the CRDT. How to make sure that the CRDT stays up to date and catches up to the last modification?
- The server may be running as a cluster with multiple instances. Should each instance initiate a CRDT and how do we sync between the instances?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.