hocuspocus
hocuspocus copied to clipboard
v3 - WIP
goals:
- ⏳ Separate connection / provider more, make it more easy and remove weird hacks that were added to keep BC with v1
- ✅ Separate Hocuspocus server / handler logic
- subdocs support
- fix other breaking issues (#606)
- maybe we can implement reauthentication (not sure what's needed there ; maybe the provider can just re-send the info, but I think the server needs to be adjusted to handle the incoming message type)
- maybe we can finally upgrade ioredis (https://github.com/ueberdosis/hocuspocus/pull/580)
- https://github.com/ueberdosis/hocuspocus/issues/596
- https://github.com/ueberdosis/hocuspocus/issues/594
- ... (more to come)
Consider using the api Y.diffUpdate, we don't need to load ydoc into memory.
Here is the simulation syncstep1 and syncstep2 code:
if messageYjsSyncStep1
cli_sv = decode(cli_msg)
srv_state = load(name)
diff = Y.diffUpdate(srv_state, cli_sv);
send(writeSyncStep2(diff))
srv_sv = Y.encodeStateVectorFromUpdate(srv_state)
send(writeFirstSyncStep(srv_sv))
else if messageYjsSyncStep2
update = decode(msg)
srv.persist(update)
......