How ttyd, TermPair, and sshx Put Your Terminal Inside a Browser

Terminal-sharing tools like ttyd, TermPair, and sshx allow users to share a live shell session directly in a teammate's browser, bypassing the need for screen sharing over video calls. All three tools rely on a core Unix concept called the pseudoterminal (PTY), which lets a program hold the master end of a kernel-managed file descriptor pair and forward bytes to a remote interface. Despite sharing this foundational mechanism, each tool takes a distinct architectural approach to routing terminal input and output over the web. ttyd, for instance, is a minimal single-process C application that embeds its entire frontend as a byte array inside the binary and uses a simple single-byte opcode wire protocol over WebSockets. The author explored all three codebases to understand how they solve the same problem differently, highlighting that details like resize handling via the TIOCSWINSZ ioctl are essential, not optional, for a functional experience.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in