Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

👪 Realtime collaboration

Open pankgeorg opened this issue 4 years ago • 18 comments

GIF 04-12-2021 21-51-21

pankgeorg avatar Dec 04 '21 14:12 pankgeorg

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

github-actions[bot] avatar Dec 04 '21 14:12 github-actions[bot]

~There seems to be an infinite loop when autocomplete is triggered with this PR, that's why front-end tests fail. Investigating.~

pankgeorg avatar Dec 04 '21 17:12 pankgeorg

What is time_arrow? It looks like we only assign to it, but never use the value, so we can remove it?

fonsp avatar Dec 06 '21 13:12 fonsp

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!

pankgeorg avatar Dec 06 '21 14:12 pankgeorg

Can you run this with

Pluto.run(simulated_lag=1.0)

and see if it works?

fonsp avatar Dec 06 '21 19:12 fonsp

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

pankgeorg avatar Dec 06 '21 19:12 pankgeorg

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

fonsp avatar Dec 06 '21 19:12 fonsp

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)

fonsp avatar Dec 07 '21 11:12 fonsp

@pankgeorg How ready is this?

fonsp avatar Jan 17 '22 13:01 fonsp

@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)

pankgeorg avatar Jan 20 '22 12:01 pankgeorg

https://gist.github.com/fonsp/34dcc52e853baf512341034ede911f3f

fonsp avatar Jan 20 '22 13:01 fonsp

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)

pankgeorg avatar Jan 27 '22 17:01 pankgeorg

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

fonsp avatar Jan 28 '22 13:01 fonsp

First crash (browser freezed):

Schermafbeelding 2022-01-27 om 18 21 58

fonsp avatar Jan 28 '22 14:01 fonsp

Second crash (browser freezed):

Schermafbeelding 2022-01-27 om 18 23 04

The error is probably fine (and not the cause of the freeze), but you're not supposed to get that warning

fonsp avatar Jan 28 '22 14:01 fonsp

@pankgeorg looking at this now.. 😏

dralletje avatar Feb 02 '22 15:02 dralletje

f3fce3e (#1729)

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?

fonsp avatar Feb 03 '22 11:02 fonsp

Grrrrr

But you make a good point

dralletje avatar Feb 03 '22 13:02 dralletje