Yjs - Near-Realtime Collaborative Editing
Yjs   is a novel frontend library that leverages collaborative editing on multiple data types. It is the open-source implementation of a novel algorithm, called YATA  for peer-to-peer (P2P) near real-time (NRT) shared editing. In contrast to other existing shared editing frameworks that support only a very limited number of document structures, Yjs encourages developers to build custom data types.
Yjs works on modern Web browsers, including mobile (e.g., Android devices) and offers a quick and easy way to embed collaboration in Web applications.
The purpose of Yjs is to enable rapid prototyping and to offer a simple way for building scalable and reliable collaboration features in Web applications, on the client-side. Moreover, as described in , regardless of being P2P or a client-server approach, the available NRT collaboration tools (e.g. OT-based) mostly support linear data such as text or other specific ones (e.g. tree-like). Applications based on complex models must therefore map the underlying data to the data structure that is supported by the used collaboration framework. However, this process is time consuming, application-specific and often hard to achieve.
All in all, Yjs provides an open-source implementation which works directly in Web browsers, can be used P2P and offers a developer-friendly, easy and intuitive way for rapidly enabling NRT collaboration on custom data types. A custom type can use existing implemented types in order to give meaning to the actions on the data and to fire custom events. Currently, the library has implemented support for lists, associative arrays, XML, text, JSON, Polymer elements, ACE code editor, and rich text types.
Finally, besides the usage in real-world open-source products, Yjs has been thoroughly evaluated in a simulated distributed environment for performance, testing the conflict resolution and its scalability, with excellent results.
- Shared editing on multiple data structures: Yjs ensures that shared content across multiple clients is consistent and eventually converges: considering a shared document - after editing updates are propagated and integrated into the local documents by Yjs - the document is identical across all clients. Moreover the user intention is preserved, i.e. the actual effect of an operation at the time of its execution on a local document is the same with the intended effect of this operation at the time of its generation.
- Support for building custom data types; Several types and data formats are implemented:
- Usage with multiple messaging protocols (e.g. WebSockets, XMPP, WebRTC) in peer-to-peer or client-server network topologies
- Offline editing: clients can edit their local documents also when going offline; the changes will be propagated and the content synchronized once they are again online available
- Garbage collection: unnecessary (e.g., deleted) content can be removed automatically after a certain time
- Usage with all contents stored in memory or using a local Web browser database
Scaling and Integration
Overall, the Yjs library with its various connectors and types was well received by the open-source developer community. The library’s Website and repository analytics show that the Website gathered in one year over 11600 page views from more than 4500 users and the library has been downloaded over 800 times. Yjs was used to enable shared editing with the popular Quill rich text editor, which is very similar to Google Docs. The richtext component is already used by two companies in production, for NRT shared text editing on the Web, embedded in WebRTC video meeting tools.
- Synchronize movement of 3D objects across multiple users in the Web browser .
- Enable liquid Web applications, by providing a seamless user experience in using different Polymer Web components distributed across various devices.
- Enable collaboration in the SeViAnno services (for video drawing and annotation) and for synchronizing 3D anatomical objects
- SyncMeta, a framework for enabling NRT collaborative (meta) modeling on the Web.
- Community Application Editor
Yjs poster presented at the International Conference on Web Engineering, Rotterdam, 2015 on Slideshare:
Developers and Contributors
- Kevin Jahns
- Petru Nicolaescu
- Michael Derntl
- Ralf Klamma
- István Koren
- Alexander Ruppert
- Mario Rosenstengel
- P. Nicolaescu, K. Jahns, M. Derntl, and R. Klamma, “Yjs: A Framework for Near Real-Time P2P Shared Editing on Arbitrary Data Types,” in Proceedings of the 15th International Conference on Web Engineering, ICWE 2015, Rotterdam, The Netherlands, June 23-26, 2015, 2015, pp. 675–678. DOI: 10.1007/978-3-319-19890-3_55
- P. Nicolaescu, K. Jahns, M. Derntl, and R. Klamma, “Near Real-Time Peer-to-Peer Shared Editing on Extensible Data Types,” in GROUP 2016, Sunibel, USA, November 13-16 (to appear), 2016, vol. 9891, pp. 570–574. DOI: 10.1145/2957276.2957310
- P. Nicolaescu, G. Toubekis, and R. Klamma, “A Microservice Approach for Near Real-Time Collaborative 3D Objects Annotation on the Web,” in Proceedings of the 14th International Conference on Web-based Learning (ICWL), Guangzhou, China, November 5-8, 2015, 2015, pp. 187–196. DOI: 10.1007/978-3-319-25515-6_17