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

Frappe YJS ( extensible socketio) #188

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

uhrjun
Copy link
Member

@uhrjun uhrjun commented Apr 4, 2024

Drive's realtime collaboration currently depends on webrtc, and thus needs an existing signalling server. This PR changes that to use Frappe's socketio server to do realtime collaboration instead. Effectively making the realtime collaboration self-contained to within Frappe Drive. Since this is a single socket instance that treats the entire website as a namespace, existing socketio implementations aren't plug and play. So we need to roll our own yjs socketio provider for how Frappe utilizes socketio.

Current blockers:

Notes:

  • Maybe avoid using broadcast and instead just listen for an update event
  • Might lead to transactional errors with yjs or maximum call stack on transaction origin mismatch
  • Try to only use encodeStateVectorFromUpdate to distribute updates instead of sending the document

Comment on lines +4 to +5
socket.broadcast.emit("sync-update", update);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah neat, maybe this should be scoped in to a room?

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flow would be:

  • user joins doc room
  • user pushes changes to this event handler
  • This event handler broadcasts update using doc room

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

Successfully merging this pull request may close these issues.

2 participants