Title: Reliable Sync Protocol PR: Live Demo &amp; Discussion for Collaborative Editing
Author: annezazu
Published: January 7, 2025

---

 [  ](https://profiles.wordpress.org/annezazu/) [annezazu](https://profiles.wordpress.org/annezazu/)
4:36 pm _on_ January 7, 2025     
Tags: [gutenberg ( 555 )](https://make.wordpress.org/core/tag/gutenberg/),
[hallway-hangout ( 19 )](https://make.wordpress.org/core/tag/hallway-hangout/), 
[phase 3 ( 18 )](https://make.wordpress.org/core/tag/phase-3/)   

# Reliable Sync Protocol PR: Live Demo & Discussion for Collaborative Editing

On January 6th at 7PM UTC, a group gathered for a demo and discussion with Kevin
Jahns, the author of Yjs, a popular framework for building collaborative applications.
In this session, we went in depth on an [in progress pull request that implements a reliable sync protocol for collaborative editing](https://github.com/WordPress/gutenberg/pull/68483).
We also all collaborated on a post live as a fun way to test limits! Thank you to
all who joined and for Kevin for hosting. To follow future efforts in this space,
please follow [this dedicated GitHub issue](https://github.com/WordPress/gutenberg/issues/52593)
and/or join the [#feature-realtime-collaboration](https://wordpress.slack.com/archives/C07NVJ51X6K)
slackSlack Slack is a Collaborative Group Chat Platform [https://slack.com/](https://slack.com/).
The WordPress community has its own Slack Channel at [https://make.wordpress.org/chat/](https://make.wordpress.org/chat/)
channel.

## Recording

## Notes

Notes are mainly powered by an AI note taker so please leave a comment if anything
feels wildly off.

**Overview**

Kevin Jahns presented a demonstration on utilizing Yjs to enhance real-time editing
capabilitiescapability A **capability** is permission to perform one or more types
of task. Checking if a user has a capability is performed by the `current_user_can`
function. Each user of a WordPress site might have some permissions but not others,
depending on their role. For example, users who have the Author role usually have
permission to edit their own posts (the “edit_posts” capability), but not permission
to edit other users’ posts (the “edit_others_posts” capability). in WordPress, addressing
existing challenges such as content synchronization and potential conflicts during
simultaneous edits. He introduced features like automatic conflictconflict A conflict
occurs when a patch changes code that was modified after the patch was created. 
These patches are considered _stale_, and will require a _refresh_ of the changes
before it can be applied, or the conflicts will need to be _resolved_. resolution
and a heartbeat APIAPI An API or Application Programming Interface is a software
intermediary that allows programs to interact with each other and share data in 
limited, clearly defined ways. for near real-time updates, emphasizing that while
the current implementation may not fully replicate the Google Docs experience, it
significantly improves user trust and collaboration. Participants were encouraged
to explore Yjs further and consider its applications in their projects.

Jahns discussed the technical obstacles in implementing collaborative editing, particularly
the lack of WebSocket support across various PHPPHP The web scripting language in
which WordPress is primarily architected. WordPress requires PHP 7.4 or higher engines
and the limitations of WebRTC, which requires multiple servers for reliable operation.
He proposed using HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. 
HTTP is the underlying protocol used by the World Wide Web and this protocol defines
how messages are formatted and transmitted, and what actions Web servers and browsers
should take in response to various commands. requests for syncing while allowing
WebRTC as an optional enhancementenhancement Enhancements are simple improvements
to WordPress, such as the addition of a hook, a new feature, or an improvement to
an existing feature.. Additionally, he highlighted issues with blockBlock Block 
is the abstract term used to describe units of markup that, composed together, form
the content or layout of a webpage using the WordPress editor. The idea combines
concepts of what in the past may have achieved with shortcodes, custom HTML, and
embed discovery into a single consistent API and user experience. validation errors
and synchronization challenges with custom block types in the GutenbergGutenberg
The Gutenberg project is the new Editor Interface for WordPress. The editor improves
the process and experience of creating new content, making writing rich content 
much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML
etc. [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/) editor,
suggesting the creation of a special editor binding for Yjs to improve synchronization.
Security concerns regarding the WebRTC setup were also raised, with a focus on the
need for role-based collaboration restrictions to prevent document manipulation.

The session also covered the storage and management of Yjs documents, with Jahns
explaining that Yjs content is stored as comments in post content, facilitating 
straightforward revision creation. He acknowledged the challenges of managing real-
time changes and the impact of Yjs documents on content size. Discussions included
the limitations of WebRTC, particularly its reliance on costly TURN servers, and
the need for ongoing testing to ensure the reliability of collaborative editing 
features. Jahns emphasized the importance of prioritizing collaborative editing 
to enhance the editor’s evolution and received appreciation for his transparency
and commitment to the Gutenberg project.

**Real-Time Editing Demo with Yjs**
Kevin Jahns presented a demo on real-time editing
with Yjs, emphasizing its role in enhancing collaborative features in WordPress.
He explained the limitations of the current WordPress editor regarding content synchronization
and introduced new features like automatic conflict resolution and the heartbeat
API for better real-time collaboration.

**Collaborative Editing in WordPress**
Kevin Jahns addressed the difficulties of
enabling collaborative editing in WordPress, noting that WebSockets are not universally
supported across PHP engines. He explained that while WebRTC could be used as a 
fallback, it is not reliable enough for all users. Instead, he proposed using HTTP
requests for syncing, with WebRTC as a progressive enhancement for those who can
utilize it.

**Block Synchronization and Customization Challenges**
Kevin Jahns addressed synchronization
issues with block types (and ran into an error with block validation in the process!).
He explained that while standard elements like text and images function properly,
custom block types may encounter difficulties due to Gutenberg’s design, which does
not fully accommodate changes from multiple peers. Jahns emphasized the need for
a special editor binding for Yjs to enhance synchronization.

**Discussion on Signaling Server and Security Concerns**
Kevin Jahns confirmed that
Jorge’s signaling server implementation in WordPress remains unchanged. He raised
security concerns regarding the WebRTC setup, highlighting that it permits document
manipulation by anyone with read access. Jorge noted that to make the system production-
ready, several security measures need to be implemented, particularly around user
roles and collaboration.

**Yjs Document Storage and Revision Management**
Kevin Jahns responded to Frank’s
inquiry about the Yjs implementation and its impact on content revisionsRevisions
The WordPress revisions system stores a record of each saved draft or published 
update. The revision system allows you to see what changes were made in each revision
by dragging a slider (or using the Next/Previous buttons). The display indicates
what has changed in each revision.. He detailed that Yjs documents are stored as
comments within the post content, which facilitates the creation of revisions upon
saving. Additionally, he mentioned that future comparisons of revisions could be
made using Yjs documents, similar to a git diff, and that attribution for content
creation is also supported.

**Discussion on Yjs Document Implementation and Security Concerns**
Kevin Jahns 
highlighted the downside of Yjs documents inflating content size but reassured that
normal users wouldn’t see the comments. Aaron Jorbin pointed out the security implications
of allowing users to input unfiltered HTMLHTML HyperText Markup Language. The semantic
scripting language primarily used for outputting content in web browsers.. Kevin
also mentioned the potential for filtering user visibility of Yjs comments and the
need to track edits made by users, which currently lacks a backend solution.

**WebRTC vs. WebSocket for Collaborative Editing in WordPress**
Kevin Jahns explained
that WebRTC is not a reliable option for collaborative editing in WordPress due 
to its dependency on multiple servers and potential blocking by companies. He suggested
using HTTP requests as a baseline for collaboration, which provides a satisfactory
experience for most users. For those needing more reliability, he mentioned the 
possibility of implementing WebSocket servers, which could also enhance security
and authentication.

**Discussion on WebRTC and TURN Servers**
Kevin Jahns highlighted the overhead of
WebRTC and the expense of hosting TURN servers, indicating that they are not a viable
option for everyone. Jorge shared his thoughts about the reliability of TURN servers
from providers like Google and Twilio. They noted that while STUN servers are affordable
and public, TURN servers are costly and can lead to misuse.

**Collaborative Editing and Yjs Integration**
Kevin Jahns highlighted the challenges
faced with collaborative editing in the current editor setup, particularly issues
with image handling and the undo-redo functionality. He stressed the necessity of
prioritizing collaborative editing and proposed using Yjs as a solution to enhance
these features. Kevin also mentioned that recent updates to Gutenberg have caused
disruptions, indicating a need for better testing and support.

**Yjs Integration and Block Syncing Challenges**
Kevin Jahns explained the process
of syncing textual content through JSONJSON JSON, or JavaScript Object Notation,
is a minimal, readable format for structuring data. It is used primarily to transmit
data between a server and web application, as an alternative to XML., noting that
changes in one block can overwrite changes in another. He acknowledged existing 
issues with tables and galleries, indicating that these would be addressed in future
pull requests. Kevin also highlighted the importance of creating a robust integration
with Yjs for better collaboration.

[#gutenberg](https://make.wordpress.org/core/tag/gutenberg/), [#hallway-hangout](https://make.wordpress.org/core/tag/hallway-hangout/),
[#phase-3](https://make.wordpress.org/core/tag/phase-3/)

### Share this:

 * [  Threads ](https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/?share=bluesky)
 * [  X ](https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/?share=x)
 * [  Facebook ](https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/?share=linkedin)

# Post navigation

[← Performance Chat Agenda: 7 January 2025](https://make.wordpress.org/core/2025/01/07/performance-chat-agenda-07-january-2025/)

[Agenda, Dev Chat, Jan 8, 2025 →](https://make.wordpress.org/core/2025/01/08/agenda-dev-chat-jan-8-2025/)