Frappe YJS ( extensible socketio)
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:
-
[x] https://github.com/frappe/frappe/pull/25592 needs to be merged
-
[ ] Graceful connect & disconnect events
-
[ ] Document destroy event
-
[ ] Awareness protocol to comply with
CollaborationCursor -
[ ] Broadcast channel communication to prevent cross tab state mismatch
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