Problem/Motivation
Because we are already storing the data state in server side only (browser side is stateless) and our State Maanger ahs already proved its robustness when we edit same data from multiple users, we will be able to activate real-time collaboration once those 2 issues are done:
- #3529074: Better logs: user ID will be stored in logs
- bigskysoftware/htmx: Combining sse and oob
Proposed resolution
Everytime an user is updating the data state, a SSE event is sent to other users editing the same display.
It would be nice to show in the toolbar the ID of other connected users.
Out of scope
We don't show the cursor of the other users on the screen like Figma is doing. Let's keep it simple and light, leveraging what HTMX is providing and not much more.
Issue fork display_builder-3534137
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pdureau commentedComment #3
pdureau commentedWill be done in #3535989: Add an ActiveUsers island
Comment #4
pdureau commentedComment #5
pdureau commentedHTMX seems ready:
https://github.com/bigskysoftware/htmx-extensions/pull/94
Symfony has a nice API for this: https://symfony.com/blog/new-in-symfony-7-3-simpler-server-event-streaming
Le's do it
Comment #7
pdureau commentedstarted by Pierre. Who want to continue?
Comment #8
grimreaperComment #9
pdureau commentedCareful:
https://www.reddit.com/r/htmx/comments/1mjhzl1/gohtmx_server_sent_events...
Comment #10
grimreaperComment #11
grimreaperI am checking why the lib is loaded twice on pages.
In the meantime there are questions in the MR.
Comment #12
grimreaperI found how to update to latest SSE extension version. But still 2 calls to the SSE endpoint.
Maybe a bug in the extension. I have not found related stuff in https://github.com/bigskysoftware/htmx-extensions/issues
Comment #13
grimreaperComment #14
grimreaperThe MR also fix 2 bugs: one in history panel and the other in active users panels.
Comment #15
grimreaperComment #16
pdureau commentedComment #17
pdureau commentedFor information, we have some moment where drag and/or drops from and/or to the root dropzone are not synched properly. After investigation, it seems this may not be related to this change.
However, by pushing the limit of the display builder events management, this change may help us to find already existing issues.
Comment #18
pdureau commentedComment #19
pdureau commentedSomething else to check before review
Comment #20
pdureau commentedI need to talk with Grimreaper about 2 subjects:
returnstatemenstComment #21
grimreaperAs discussed, point 1 is OK.
I will check point 2 tomorrow.
Comment #22
grimreaperComment #23
pdureau commentedComment #24
pdureau commentedI do some of the threads
Comment #25
pdureau commentedResolved some MR threads.
Only 2 left: https://git.drupalcode.org/project/display_builder/-/merge_requests/46/d...
Comment #26
pdureau commentedComment #29
mogtofu33 commentedNice work, looking great.
There is the follow up with 2 sse connection to fix.