Skip to content

Real-time collaboration: determine default transport layer #74085

@annezazu

Description

@annezazu

As real-time collaboration is being developed for possible inclusion in WordPress 7.0, a critical architectural decision remains unresolved: what should be the default transport layer shipped in Core? This issue is meant to centralize the conversation and decision on this in a shared place as I'm starting to see it pop up in various places.

Background context

Real-time collaboration aims to bring Google Docs-style simultaneous editing to WordPress, powered by Yjs (a CRDT framework). The architecture to do this breaks down into three components:

  • Interface: Avatars, presence indicators, UI elements
  • Engine: Yjs-based sync that records and merges changes
  • Transport: How data synchronizes between collaborators

The Interface and Engine will ship in Core. But what should the default Transport be, especially as WordPress runs on everything from basic shared hosting to enterprise infrastructure? Ultimately, the default transport needs to work reliably across this entire spectrum while still providing a meaningful collaborative experience.

The Problem

As outlined by @youknowriad in the original architecture post:

"The most performant transport layers rely on a centralized WebSocket server and a lot of PHP hosting providers don't have support for restful communication using web sockets. This means that we need an alternative communication layer that can work with any WordPress install by default while allowing the communication layer to be replaceable by plugins/hosts."

And as @matveb noted in the Real-Time Collaboration vision:

Capabilities "should be available to the widest possible audience," using "technologies that don't rely on sophisticated server setups."

Various options

A range of options have been discussed and explored, from WordPress VIP using WebSockets to @dmonad exploring HTTP requests for syncing. This isn't wholly comprehensive but here's what I've seen discussed:

Option Technology How It Works Experience Requirements Notes
1 HTTP Long Polling Server holds request open until data is available, then client immediately reconnects Higher latency; periodic updates Any WordPress install (basic LAMP/shared hosting) Universal fallback; uses existing autosave API
2 AJAX Long-Polling Similar to HTTP long polling; browser keeps connection open waiting for server updates Higher latency Any WordPress install Not ideal for collaborative editing due to latency.
3 WebRTC Direct peer-to-peer browser connections; no server middleman for data transfer Better latency; reduced server load Browser support; may need TURN servers for reliability Progressive enhancement; not reliable for all users
4 WebSockets Persistent two-way connection between browser and server Real-time Google Docs-like experience Hosting with WebSocket support Best experience; used by WordPress VIP; not universally supported across PHP hosts

Metadata

Metadata

Assignees

Labels

[Feature] Real-time CollaborationPhase 3 of the Gutenberg roadmap around real-time collaboration[Type] DiscussionFor issues that are high-level and not yet ready to implement.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions