Introducing a collaborative terminal for pair programming

As engineers, we know how difficult it can be to piece together an unwieldy combination of tools to pair program effectively, especially when terminals are involved.

For example, teams looking for ways to share a terminal might initially turn to traditional video-conferencing tools, but this solution makes text blurry, adds significant latency, and even makes it easy to leak credentials if you accidentally reveal them on screen. Alternatively, engineers can opt to work together through terminals built into collaborative IDEs or by combining tmux with SSH, but these solutions don’t allow teammates to share other windows, such as emulators or browser windows, or to communicate through audio/video chat—which in turn requires teams to juggle multiple open apps just to work together.

Meet the collaborative terminal in CoScreen

To solve these problems through a single tool, we’ve built a shared terminal that lets you run commands, debug, and write code collaboratively with near-zero latency and is integrated with rich video chat and screen sharing capabilities. It is a new beta feature in CoScreen, the collaboration tool by Datadog that was built for engineers, by engineers.

Shared terminal in CoScreen by Datadog that lets you run commands, debug, and write code collaboratively with near-zero latency.

In this blog post, we will cover:

  • Key features of the collaborative terminal
  • How the collaborative terminal works
  • How to get started
  • A new way to collaborate in terminals

With the collaborative terminal in CoScreen, you can pair program and even mob program in your terminal with up to 10 team members. Terminal input and output is transmitted as PTY/text with near-zero latency. Teammates can share control to edit collaboratively in real time—and even copy and paste. It also comes with a secret-filtering feature that helps you keep sensitive strings like your passwords and private RSA keys private.

Key benefits of the collaborative terminal in CoScreen

  1. Speed: It transmits terminal content as PTY/text data and not as video, delivering 80% lower latency compared to traditional screen sharing.
  2. Enhanced collaboration: Up to 10 users can view the shared terminal and collaborate within it—while simultaneously taking advantage of built-in audio and video chat and multi-user screen sharing.
  3. Annotations: Users can draw on the shared terminal to highlight items for other participants.
  4. Security: Through the use of data encryption, along with RegEx pattern matching and entropy-based secret scanning and filtering, it enables you to share your terminal in a more secure way than is possible with other solutions.

And because it is built into CoScreen, engineers also benefit from all of CoScreen’s functionality as they work together within shared terminals, gaining the ability to:

  • Share the entire display, or individual windows, with built-in audio and video chat.
  • Simultaneously share windows from multiple displays at the same time.
  • Allow multiple users to share screens with each other at the same time.
  • Retain control of any apps without letting anyone steal your window and mouse focus.

The shared terminal in CoScreen by Datadog lets you run commands, debug, and write code collaboratively with near-zero latency.

How the collaborative terminal works

The shared terminal is built around a PTY module, CoScreen, and the underlying open source video conferencing platform Jitsi. The PTY module is a high-performing custom that's written in Rust, which connects to a pseudo-terminal on the underlying system. This pseudo-terminal is responsible for generating the input and output streams of the terminal session.

The data channel of CoScreen is used to securely transmit the encrypted PTY data alongside remote control data, annotations, and other in-band metadata about the ongoing session. If there are only two participants, the data channel produces, preferably, a P2P, DTLS-encrypted WebRTC data channel connection between the CoScreen peers. If there are more than two participants, and as a fallback method for two participants, it relies on a single secure WebSocket connection to the Jitsi VideoBridge. This connection can be established via outgoing SSL on port 443, which makes it compatible with most corporate firewall scenarios. The fallback WebSocket connection, also known as the BridgeChannel, is a standard connection to the Jitsi VideoBridge and is a HTTPS/SSL encrypted channel.

Terminals side by side with and without secret filtering

To ensure the protection of sensitive information such as credentials and passwords, the terminal has a basic mechanism to hide suspected secrets before they are transmitted. Among other components, this feature relies on Datadog Sensitive Data Scanner to detect sensitive information in strings that would otherwise be shared with remote users. The scanner is configured to detect various types of sensitive information, such as passwords, private RSA keys, GitHub API keys, tokens, credit card numbers, and social security numbers. When these strings are detected during a terminal sharing session, the scanner will replace it with wildcards before transmission.

Note that secret filtering is an experimental feature that can’t be disabled in this first version. If you want to share your unredacted terminal, you can still do so via the traditional CoScreen-way: by clicking on the “Share” tab above the terminal window.

How to get started in CoScreen

It’s easy to get started with terminal sharing in CoScreen. Simply take the following steps:

  1. Download and launch CoScreen (it’s free for small teams)
  2. Start a CoScreen meeting
  3. Click on Share terminal in the meeting menu
Start the collaborative terminal in CoScreen

🏁 After this last step, the shared terminal will appear for you and all other participants in the CoScreen session. If you enable remote control in CoScreen, other users can type and click into your terminal:

0:00
/0:15

CoScreen live demo

What’s next?

The collaborative terminal is now available as a beta feature in CoScreen. Currently, you can collaborate with your local user profile and many of your customizations loaded. But since we are still building out this feature, we are actively soliciting your input about what other capabilities you’d like to see. Tell us what you’re missing the most!

If you want to try it out, you can get started with the terminal in CoScreen for free in under two minutes.