Real-time collaboration: Implement proof-of-concept long-polling (SSE) sync provider #74331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
A proof-of-concept exploring a default Yjs provider based on long-polling (server-sent events) and state stored in the WordPress database. See #74085
Why?
The current default provider is based on WebRTC and is unreliable in certain network conditions. Making it reliable requires centralized infrastructure that is probably unattainable.
An alternative default transport could use long-polling against an internal endpoint with state stored in the WordPress database. This approach would face performance issues on medium-to-large sites but would allow users to explore collaborative editing under some protective limits (e.g., a maximum of two simultaneous collaborators). Moving beyond these protective limits would require a more robust host-provided transport such as WebSockets.
How?
HttpSseProvider/sync/v1/messages. The new provider will connect to this endpoint.EventSourceconnections to this endpoint.Limitations and considerations
HttpSseProvideropens a newEventSourceconnection for each instance. As we provide support for additional entity syncing, this will consume more and more HTTP connections, overwhelming lower-resourced hosts.EventSourceconnection, which will require separately tracking therooms andlast_message_ids for each client.Testing Instructions
Testing Instructions for Keyboard
n/a
Screenshots or screencast
sse-sync.mov