Skip to content

Comparing SwellRT with Etherpad

Pablo Ojanguren edited this page Mar 20, 2017 · 1 revision

Note: thanks to JohnMcLear (Etherpad) for pointing out our mistakes in this analysis.

What is SwellRT?

SwellRT is an open source fork of the Apache Wave project, which turns the inner Wave technology into a general-purpose developing framework for collaborative and decentralized software.

SwellRT is (in "plain words") a backend as as service. It provides a simple API to Web apps to transparently manage:

  • Data storage with real-time sync and search index.
  • User management and authorization.
  • Event-based integration.

Apache Wave is a software for real-time online collaborative text editing. Google originally developed it as Google Wave. After the service shutdown in 2010 Wave was accepted by the Apache Software Foundation's Incubator program under the project name Apache Wave.

What is JetPad?

On top of SwellRT, we are also developing JetPad a frontend for a full-fledged collaborative text editor.

JetPad/SwellRT's aim is to provide a modern alternative to Etherpad, skiping its current technical limitations as we explain down below.

Where can I see SwellRT in action?

You can check a simple example here Check out the source code of the web page. Simple, aha? That's it!

That example uses the new beta implementation under development. For more info check out the README or beta README

Why to compare Etherpad with SwellRT?

Etherpad is the most successful Open Source project introducing real-time text editing. It has a lot features and a plugin-based design for extension and customization.

Both systems are based on Operational Transformations (OT) a technology enabling collaborative text editing. Uses of this technology are rather complex in terms of design and implementation, consequently there are only a scarce number of applications that employ it. Here we would like to explain the differences between those OT systems that enables some advantages for SwellRT.

Operational Transformations: a short introducction

Operational transformation systems (OTs) are algorithmic systems which resolve gracefully concurrency conflicts when different users edit a text at the same time in an online software, by means of determining a proper real-time synchronization rule for modifications in the document.

In general, OT systems deal with a document as a sequence/list of operations that modifies its content, aligned with previously executed operations. They mainly concern sets/modifications of symbols, generally text characters, but are not limited by them. A simple example is shown in the following table.

Resulting Version User action Operation
v0:
v1: Hello Alice writes the word “Hello” at position 0 insert(0, “Hello")
v2: Hello World Bob writes the word “World” at position 6 insert(6, “World”)

This approach has inherent benefits: it provides an implicit history of changes and it is a simple format for data transmission in a network. However, there are significant differences between the two aforementioned OT systems as it is exposed below.

For a deeper info you read the Wikipedia page

EasySync and Wave OT

EasySync is the name of Etherpad and Etherpad's Operational Transformation system. Wave OT refers to the -originally developed by Google- OT system that is at the core of SwellRT.

The Easysync OT model only works with plain text characters and attributes. On the other hand, Wave OT model works with an XML-like documents, so conflict resolution is managed not only when a text character is inserted or deleted, but also when, for example, a tag or tag attributes are edited (allowing for instance rich text edition).

In addition to this XML flavour, Wave OT model also supports text annotations. A text annotation is a tuple of start and end positions, a key and a value.

And finally, the Wave OT model also includes as symbols some data entities grouping XML documents and participants.

Handling document text and metadata

Whereas characters are the main data within text documents, in real life, document’s metadata are part of the real-time collaborative experience. Examples of metadata are text styles (bold, italic, font type, etc), comments, bookmarks, headers and sections, embedded contents (videos, pictures, etc), and also participants and access control lists.

The Wave OT design, by supporting XML and annotations, allows the implementation of all the examples of text metadata in a straightforward manner. In summary:

  • Developers can easily define new metadata types (e.g. suggestions, comments and embedded images) just calling the web API (i.e doc.setAnnotationOnSelection("suggestion", "This is wrong!")).
  • Text and metadata are part of the same final data representation (XML+Annotations), which allows easy implementation of bulk operations such as export/import from/to others formats.
  • Since the participants and access control list is also document metadata, authorization data is coherently tied into the document itself.

A comment on Etherpad architecture

Etherpad brings user inteface and business logic in the same code base. This restricts integration possibilities with other web apps -mainly through iframes- and different frontend technologies or frameworks.

JetPad-SwellRT: a decoupled architecture

SwellRT provides a set of backend services consumed through a Web API (data storage, user management, search service...) SwellRT also provides a reusable and extensible Text Editor web component that can be used in any web app.

Jetpad is a totally separated web app developed in Angular2/Bootstrap that uses the SwellRT JavaScript API and its Text Editor web component to provide a fully-fledged collaborative editor. Benefits of this approach are:

  • Considerable easiness to customize JetPad user interface without knowing internals of SwellRT.

  • Considerable easiness to integrate collaborative editing in existing web apps.

  • Anyone can build compatible frontends with any alternative web technology.

  • Additional collaborative services around the text editing can be easily developed using SwellRT API for real-time collaboration (e.g. chat, dashboards, etc).

  • Possibility to develop mobile native versions. SwellRT mid term roadmap includes mobile native implementations of its API.

Access Control to documents

Authorization is a well-known issue in the current implementation of Etherpad. Access control to pads are handled in groups preventing a single user to have read and write permission for a single document.

SwellRT access control is much more rich: each document has a list of participants together with their rights (read and write). Besides, it may allow anonymous access. As the participant list is part of the document metadata, document security is tracked in the document’s version history as well.

Another advanced feature of SwellRT is the private area for user data in each document. That can be used to store private metadata such as bookmarks and notes.

Support for teams (groups) is also about to be implemented.

Scalability

SwellRT is kind of a micro-service, using MongoDB directly as database engine allowing horizontal scaling. Internally it is built with a bus-based architecture.

Federation of servers

SwellRT servers, and thus documents and users, can be federated (i.e. users from different servers can work with documents from other servers). The former implementation based on XMPP transport is being replaced by Matrix protocol thanks to a Google Summer of Code intern.

Text Editor as separated Component

To design a text editor for the Web is a complex task. A good article from a Medium’s engineer and former Google employee depicts the challenge, describing what is a good design for a Web rich-text editor.

The SwellRT (based on Wave's one) text editor component is a powerful well designed software piece that works seamlessly with Wave OT documents. It supports dynamic extensions to render and interact with any type of document’s metadata through widgets, annotation controllers, and event hooks.

The editor is a decoupled component, and therefore its updates and fixes can be deployed independently to any web app without side impacts.

<div id="editor"></div>

<script>

  var editor = swellrt.Editor.createWithId("editor");
  var text = swellrt.Text.create("Hello World");

  editor.set(text);
  editor.edit();

</script>