Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate text app HPB sync options #2669

Open
8 of 23 tasks
juliusknorr opened this issue Jul 4, 2022 · 5 comments
Open
8 of 23 tasks

Evaluate text app HPB sync options #2669

juliusknorr opened this issue Jul 4, 2022 · 5 comments
Assignees

Comments

@juliusknorr
Copy link
Member

juliusknorr commented Jul 4, 2022

Initial Experiments

  • Try plugging in the new collaboration extension into nextcloud text -> works if we drop user colors
  • Check how easily we can use https://tiptap.dev/hocuspocus/ as a drop in replacement for our polling based sync backend
    • First implementation uses y.js steps but sends them over the existing sync backend and still uses client side logic to save the file

Drop in Replacement

#2847

Use the yjs based collaboration extension with the existing server API (+small modifications).
Turn the sync service provider experiment into a working solution.

  • send and store steps encoded as base64
  • combine multiple yjs changes into a single change before they are send to the server
  • remove the DB lock when pushing changes to the server
  • write tests for joining an existing editing session and collaborating
  • write tests for opening an existing md file and collaborating on it
  • test performance under load - maybe during contributor week.

Explore combining with other providers

During company week:

  • See if using notify_push just for the message passing is an option that may improve the situation Using notify_push for syncing #1805
  • Try combination of sync service provider with webrtc
  • Try combination of sync service provide with hocuspocus
  • Prioritize / pick combination to work on (first)

Combine with Hocuspocus

Use Hocuspocus to send steps and awareness messages between clients more efficiently.

  • Allow configuring a hocuspocus url
  • Define a mapping from a text file to a hocuspocus document
  • Implement access control like tokens or JWT to validate that clients are allowed to connect to the web socket of a specific document.
  • We need to clarify how this could be handled from a license/release perspective as hocus-pocus is currently in private beta, repos is private, npm package is public already

Awareness (user presence and authorship)

  • Use yjs awareness instead of our current user session tracking
  • explore implementing user colors based on yjs awareness
  • plug in user cursor extension

Fully integrate

Combine the various providers seamlessly and make use of their strength.

  • Serialize markdown and store it to the server from within hocuspocus
  • Detect available providers in the client and use them accordingly
  • Compress document history
@max-nextcloud
Copy link
Collaborator

We also need to look into authentication - both of the clients connecting to the hokuspokus server as well as the auth of the write from the hokuspokus server to storage backends - especially if those are special backends such as shares or external storages.

@juliusknorr
Copy link
Member Author

juliusknorr commented Jul 11, 2022

As discussed, let's focus on the following in order:

  • plugging in hocuspocus as as an optional component for syncing the steps
    • first make general collaboration work
    • save process
      • still save the document on the client
      • Concurrent saving could be avoided by having one client that pre-announces the save process through web socket so that others won't save in the meantime
    • authentication
      • maybe use JWT with a shared secret to verify access of sessions
  • Explore options to use y.js with our existing php backend

@juliusknorr
Copy link
Member Author

https://discuss.yjs.dev/t/stateless-server-broadcasting-implementation-in-go/393 Is an interesting read for the option to reuse our php backend as a fallback with y.js, so this should work while having no compression of the previous steps (which we don't have anyways with the current approach) so y.js would even be more lightweight by not using json for the steps.

@max-nextcloud
Copy link
Collaborator

https://github.com/nextcloud/text/tree/experiment/yjs has a minimal working tiptap2 collaboration based on tiptaps public websocket server.

@juliusknorr juliusknorr moved this from 📄 To do (5-20 entries) to 🏗️ In progress in 📝 Office team Jul 13, 2022
@max-nextcloud
Copy link
Collaborator

https://github.com/nextcloud/text/tree/experiment/minimal-yjs keeps more of our current session handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants