Collaborative text editing with Gobby

1485

Author: Joe 'Zonker' Brockmeier

Wikis and groupware are great for distributed collaboration between teams, but they lack the ability to provide real-time feedback to teams working on a shared document. Collaborative editors, on the other hand, give multiple users a convenient way to work together on one or more documents. Mac users have had SubEthaEdit for some time, but Gobby is the first collaborative editor for Linux, Windows, and Mac OS X users. Let’s take a look at how you can start editing documents with your friends and co-workers using Gobby.

I’m using Gobby 0.3, which is available in packages for Ubuntu 6.06 Long Term Support (LTS), Debian testing/unstable, Gentoo, and Fedora Core 5 (and probably other distros). If Gobby isn’t available as a package for your favorite distribution, or it’s only available as an older release, visit the download page and grab the source for Gobby and its dependencies.

Specifically, Gobby depends on Obby and net6, from the same project. Obby is the framework used to synchronize document changes, and net6 is the network library used by Obby. The project also offers a server for the protocol, called Sobby, that I’ll discuss shortly.

Gobby is also available for Windows, so you can collaborate with friends on that operating system. See the install guide for instructions on how to build Gobby from source or install the Windows version.

If you’re on Ubuntu 6.06, all you need to do is run apt-get update ; apt-get install gobby.

Starting a session

Once you have Gobby installed, you can start editing. Since Gobby is a collaborative text editor, it works a bit differently than Vim, gedit, or Kate. Before you can work on a document, you need to create a session that will allow other users to share and work on a document with you. Run gobby, and click on “Create session” when Gobby starts.

The session dialog allows you to set the port that Gobby listens on, your username, an optional password for the session, and the color of the text highlight for your changes so you can distinguish your changes from other users’. You’ll want to use a relatively light color so you can actually see the text; the first time I started Gobby it defaulted to a deep blue color that obscured the text completely. The default port is 6522, which should be fine unless you’re aware of something else running on that port already.

Once you have the session open, pick a document you want to share, or create a new one. When other users join your session, they’ll see the document that’s open and be able to “subscribe” to that document to work on it.

Joining a session

If you’d like to join a Gobby session already in progress, click the “Join session” button, then tell Gobby what host, port, and username you’d like to use. Gobby uses Zeroconf to advertise its sessions, so if you’re joining a session on a local network, odds are Gobby already knows about the session; just click the “Local network” button at the bottom of the “Join session” dialog, and select the Gobby session you’d like to get in on.

Once you click OK, you’ll be connected to the session — unless the other Gobby user has set a session password. In that case, you’ll be given a “wrong password” error, and prompted to give the session password. Once you log in, Gobby will display a list of documents that you can subscribe to, or you can open a document and share it yourself. Any user can open a document for editing by all users — not just the user who initiated the session.

As one user edits a document, all the other users in a session see the changes in real time. Each user’s contributions should be in different colors. At the bottom of the session, Gobby has a chat area, so users can discuss changes or just banter idly while others are editing. By default, Gobby sports line numbers and displays a right margin of 80 characters. These can be changed by going to Edit -> Preferences and then selecting the View tab.

Gobby also has a user and document list, so you can see which users are connected to a session, and which documents they are subscribed to.

Other editors

Gobby’s actual editor is pretty sparse. It has basic find and replace functions, support for multiple documents in tabs, syntax highlighting for a bunch of languages, indenting, and a few other goodies — but it’s got nothing on Kate, Vim, Emacs, or other mature editors.

Gobby even lacks an undo function, which is usually considered pretty basic, but an undo function is hard to implement in an editor when multiple users are making changes to a document.

In addition to lacking undo, Gobby also lacks the concept of privileged users. All users working on a document are equal, so anyone may make changes or delete sections, and there’s no way to lock a document or section or restrict it to specific users — other than setting a session password and not distributing it, of course. In some situations, it would be nice to have users with “read-only” permissions, as well as admins and unprivileged users.

The good news is, Gobby is still under development, and there is even work towards adding Obby support to other editors, such as Emacs. (I haven’t found anything for Vim yet.) The Emacs implementation seems to work fine, though it lacks the chat function.

To use Obby with Emacs, download ebby.el and load the file in Emacs. Then run Esc-x ebby to load Ebby, and it will prompt you for connection information. After you’ve joined the server, you can subscribe to documents using Esc-x ebby-subscribe.

Using Sobby

If all of your collaboration depends on a user’s desktop machine, things could get inconvenient when the host machine’s user decides to reboot or turn off his computer for the night. However, the Gobby team also provides Sobby, a dedicated server for editing documents. If you have users in several locations, you can run Sobby on a public server so that all users can connect, and when a user disconnects, no worries — the documents are still available to other users, and everyone else can keep working away.

To install Sobby, use apt-get install sobby on Debian and Ubuntu systems, or see the install instructions on the Gobby site.

To start managing sessions with Sobby, start the server using sobby -p 6522 --password password. The port and password are optional; 6522 is the default port, but you can set it to anything you like.

If you’d like the server to auto-save sessions, use the --autosave-file and --autosave-interval options. For example, sobby --autosave-file savefile --autosave-interval 10 to save the session in a file called savefile every 10 seconds. To restart a saved session, run sobby savefile.

Final thoughts

Despite its immaturity, Gobby is a good choice when two or more users want to collaborate on a text document in real time. Want to browse through a log file with another admin to troubleshoot a problem, or work together to edit a configuration file? Need to write up release notes for a project, work on some documentation, or put together a requirements list? Gobby makes things much simpler than passing around a text document or OpenOffice.org file with changes. The Ubuntu folks are even using Gobby to allow remote developers to participate in the Ubuntu Developer Summit.

Gobby’s developers have done an excellent job so far, and I’m looking forward to seeing what new and interesting features they will add in the future. With any luck, other developers will start integrating Obby into their editors, and we can all collaborate no matter which editor we prefer.