👪 Realtime collaboration

Try this Pull Request!
Open Julia and type:
julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="local-state-sync-main")
julia> using Pluto
~There seems to be an infinite loop when autocomplete is triggered with this PR, that's why front-end tests fail. Investigating.~
What is time_arrow? It looks like we only assign to it, but never use the value, so we can remove it?
What is
time_arrow? It looks like we only assign to it, but never use the value, so we can remove it?
Yeap, should be good to go!
Can you run this with
Pluto.run(simulated_lag=1.0)
and see if it works?
and see if it works?
It does work - you can "break" it if you start typing in an intermediate state but the fix for that is something much more complicated.
Update: I found a case where it doesn't sync to the latest state, which I think can be fixed in this context. - brb
Refreshing is glitchy:
https://user-images.githubusercontent.com/6933510/144913250-713bacfd-db28-49f1-bb17-7fd2465758a2.mov
It looks like this caused by a new client connecting:
https://user-images.githubusercontent.com/6933510/144913704-3641a18e-c9c9-40f4-b424-16d0aa5a004c.mov
This also looks like the new logic to check if the cell changed (display in dark yellow) is not always correct, because both sides show the cell as unchanged after the refresh
Can you call it my_author_name instead of client_id? We already have a client_id in our websocket logic, but they are not the same (and it's good to not use the same because websocket logic should be as isolated as possible)
@pankgeorg How ready is this?
@pankgeorg How ready is this?
When you have lag and two people are typing, it is possible to get to a state when you see something different than the other client, as a 'final' state of the document, as the two states don't converge to the same 'final' for some reason. I'm not sure if this is fixable by our current approach; I'll investigate more. It works like a charm when only one party is making edits though.
Update: But maybe the last update fixes that too Update 2: It does fix the convergence issue but it's much more unstable because older changes may be reapplied before convergence. (you write 'using Dates' and you see some of it disappear and reappear later)
https://gist.github.com/fonsp/34dcc52e853baf512341034ede911f3f
Status: works pretty well with 7 connected clients! Had to refresh once because re-application of state failed (server was ok though) Issue: When two people edit the same cell, the cursor goes back to the first line. Options: keep your cursor at the same position as before (if it exists) OR move the cursor along with the last used cursor (which re quires syncing the cursor too)
Issue: When two people edit the same cell, the cursor goes back to the first line. Options: keep your cursor at the same position as before (if it exists) OR move the cursor along with the last used cursor (which re quires syncing the cursor too)
I thought we were only going to allow editing by one person at a time? Disabling input for others
First crash (browser freezed):
Second crash (browser freezed):
The error is probably fine (and not the cause of the freeze), but you're not supposed to get that warning
@pankgeorg looking at this now.. 😏
This is great functionality but it really should not have been in this PR... We just want to get this PR done so that we can merge it, this makes that more difficult. (Right?) @dralletje or @pankgeorg let's make a new branch for those new features and undo it on this PR?
Grrrrr
But you make a good point