Part 1 | Part 2 | Part 3 | Part 4 | Part 5 |

Table of Contents

What does the future of peer-to-peer real-time collaboration look like? Thanks to the spread of emerging web technologies like WebRTC, a protocol for communication between browsers on discrete systems, Yjs, an open-source real-time collaboration framework, and y-webrtc, the Yjs connector for WebRTC, a new range of use cases is entering the picture. While there are limitations, such as certain ceilings on the number of simultaneous collaborators, developments like y-webrtc are sure to reshape the landscape of peer-to-peer collaboration for more than just content.

Some time ago, I (Preston So, Editor in Chief at Tag1 and author of Decoupled Drupal in Practice) had the chance to moderate an extended dialogue about what the future holds for Yjs, WebRTC, and y-webrtc when it comes to peer-to-peer collaboration with Tag1 colleagues Kevin Jahns (Real-Time Collaboration Systems Lead at Tag1 and founder and project lead of Yjs), Fabian Franz (Senior Technical Architect and Performance Lead at Tag1), and Michael Meyers (Managing Director at Tag1). In this multi-part blog series, we take a closer look at how to scale y-webrtc for many contributors at once, how to facilitate peer-to-peer collaboration on server environments like PHP, and what other potential applications are in the offing for y-webrtc in this fast-growing space.

Supporting peer-to-peer collaboration in PHP

As discussion around real-time collaboration and peer-to-peer collaborative editing continue to gain steam in CMS ecosystems like Drupal and WordPress, supporting and scaling y-webrtc and real-time features in server-side environments like PHP has never been more pressing. In the previous installment of this blog series, we answered several questions about y-webrtc at scale: how many collaborators it can handle at the same time and how it can operate in PHP-based environments like those supporting Drupal and WordPress through options like long polling.

Long polling vs. WebSockets vs. server pings

Though WebSockets are now supported in PHP through a variety of approaches, long polling is also a compelling and viable option, as many applications have a preference for long polling over WebSockets. Another feasible option in enabling real-time peer-to-peer collaboration in PHP settings, suggested by a contributor to the WordPress Gutenberg GitHub repository, is to leverage the pings that applications typically emit to servers. For instance, when a user opens a Gutenberg site, pings are sent at regular intervals to the WordPress server.

An option for some collaborative applications is to ensure that if a client wishes to connect to you, simply append some session information to this regular server ping such that the information is sent alongside. By leveraging this ping available in Gutenberg by default and adding a small amount of information to it, you can save resources for other requirements, since the server pings will occur irrespective of whether signaling information is contained therein or not.

Short polling

During our conversation, Fabian remarked that short polling is also a viable choice for supporting real-time collaboration in PHP, but this is highly dependent on one's architecture and situation. Even if you have a client that pings a server every second, and even if you have a large-scale server operating somewhere, all of this may not matter in the grand scheme of things, because the polling threshold will only matter if there are many frequent edits made to the document on which collaboration is happening.

The biggest issue arises from the need to poll a variety of different servers, and this is a problem that Fabian cites as one of the key arguments in favor of leveraging WebSockets for peer-to-peer real-time collaboration in PHP instead. Where WebSockets truly shine, according to Fabian, is the sweet spot between 1,000 and 10,000 users where there is considerable server load but real-time features are of paramount importance.

Applications for y-webrtc

There is a wide variety of intriguing use cases available to users of y-webrtc working on peer-to-peer real-time collaboration in decentralized applications. In this section, we summarize just a few of the exciting applications that y-webrtc makes possible. For other use cases, you can also refer to the previous installment of this blog series, where still other potential applications are covered.

Mesh support

Kevin argues throughout our discussion together that y-webrtc can serve as an optimal drop-in replacement for peer-to-peer collaboration in any web application. This presents an incredible suite of opportunities. For instance, one of the key use cases that y-webrtc enables is mesh support. Yjs, an open-source framework for real-time collaboration, exchanges document updates using a broadcast channel that also performs double duty as a browser API to communicate with other tabs in the browser session. By default, y-webrtc manages these inter-tab connections, meaning that if a WebRTC connection already exists in one tab, another WebRTC connection will not need to be created for a second tab.

This summarizes one of the more appealing features of y-webrtc, as users could also combine this approach with other Yjs providers. For example, if you wish to use another protocol such as y-dat, which supports the Dat communication layer, or if you want to use WebSockets to enable sharing of your data over both the peer-to-peer WebRTC and Dat protocols, Yjs supports meshability, where you can choose and combine these options arbitrarily according to your requirements.

Collaboration over Bluetooth

One of the other interesting potential ways to use y-webrtc is over a Bluetooth connection between two mobile devices, "just for the heck of it," as Kevin says in our recent webinar. This could open the door to a variety of opportunities. If one user wishes to collaborate with another, they could query to determine whether another device in proximity both supports Yjs and has Bluetooth enabled. Since Yjs is meshable, this doesn't present any obstacles.

Because Bluetooth functions locally and does not require connectivity to the internet, Bluetooth-driven collaboration could be particularly valuable at technology conferences where Wi-Fi can be spotty. Kevin recalls one such situation in our recent episode of Tag1 Team Talks in which he endeavored to demonstrate Yjs at a conference, but no bandwidth was available to support the hundreds of mobile devices connected to the network. This scenario inspired Kevin to consider the possibility of a physical means to transmit data. He hopes to release a y-bluetooth for Bluetooth peer-to-peer connections in 2021.

How to get involved in the Yjs community

Yjs is more than just a real-time collaboration framework; it is also a fast-growing community and expanding ecosystem made up of integrations with popular protocols and a variety of resources for developers interested in leveraging Yjs for their own collaboration requirements. For information about y-webrtc itself, you can browse the y-webrtc repository and documentation on GitHub, as well as other projects under the Yjs namespace. The Yjs website now uses both y-webrtc and y-websocket and serves as a useful demonstration of both of these integrations.

In the Yjs organization on GitHub, developers can find out about all of the connectors that are supported by the Yjs team, such as y-dat mentioned earlier in this blog post, as well as the rich text editors supported by the Yjs framework. There is also a discussion board available at, where community members stand at the ready to assist with support requests and bug reports. As the Yjs community and ecosystem continue to mature, it will be fascinating to see what emerges from contributors next. The coming years will see considerable evolution in the peer-to-peer collaboration space, and Yjs is certain to remain at the forefront.


Peer-to-peer collaboration, especially in real time, was an elusive requirement that seemed largely impossible in modern web technologies, until now. Today, thanks to the development of technologies like Yjs, WebRTC, and connectors like y-webrtc and y-dat, real-time peer-to-peer collaboration is no longer an impossibility or a pipe dream. Furthermore, with the help of techniques like long polling, WebSockets, and short polling, PHP ecosystems like Drupal and WordPress could pave a path forward for real-time collaboration on their own editorial interfaces. Finally, Yjs has an active and growing community and tools ecosystem.

In this blog post, we covered some of the other potential use cases for peer-to-peer collaboration, including collaboration over Bluetooth and prospective ways for PHP ecosystems to support decentralized collaboration. We also took a closer look at the concepts of mesh support and meshability in the Yjs ecosystem and how different connectors and services can be combined in various ways to enable rich collaboration outcomes. With this, we conclude our multi-part blog series on peer-to-peer collaborative editing with Yjs and WebRTC, but the story continues far into the future with an exciting roadmap for Yjs in the coming years as well as a trend that shows no signs of dissipating, especially as peer-to-peer collaboration continues to grow in importance across a lengthening list of industries.

Special thanks to Fabian Franz, Kevin Jahns, and Michael Meyers for their feedback during the writing process.

For more Yjs content, see Yjs - Add real-time collaboration to any application.

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 |

Photo by Matt Duncan on Unsplash