TUIOS can be accessed through any modern web browser using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Gaurav-Gosain/tuios/llms.txt
Use this file to discover all available pages before exploring further.
tuios-web binary, powered by WebGL rendering and WebTransport/WebSocket protocols.
Overview
Thetuios-web server provides:
- Full TUIOS Experience: All TUIOS features work in the browser
- WebGL Rendering: GPU-accelerated terminal rendering for smooth 60fps
- Dual Protocol Support: WebTransport (QUIC) with WebSocket fallback
- Bundled Nerd Fonts: No client-side font installation required
- Mouse Support: Full mouse interaction with cell-based optimization
- Auto-Reconnect: Automatic reconnection with exponential backoff
- Daemon Integration: Persistent sessions with multi-client support
Installation
Separate Binary Required:Quick Start
Architecture
Key Technologies
- xterm.js: Terminal emulation in the browser
- WebGL/Canvas: Hardware-accelerated rendering
- WebTransport (QUIC): Low-latency communication over UDP
- WebSocket: Fallback for universal browser support
- JetBrains Mono Nerd Font: Bundled for proper icon rendering
The web terminal functionality has been extracted into the sip library, which can be used to serve any Bubble Tea application through the browser.
Configuration
Command-Line Flags
| Flag | Default | Description |
|---|---|---|
--port | 7681 | HTTP server port |
--host | localhost | Server bind address |
--read-only | false | Disable client input (view-only) |
--max-connections | 0 | Max concurrent sessions (0=unlimited) |
--default-session | (none) | Default session name for all connections |
--ephemeral | false | Disable daemon mode (sessions don’t persist) |
Daemon Mode (Default)
By default,tuios-web connects to the TUIOS daemon for persistent sessions:
- Sessions persist when browser tabs close
- Multiple browsers/tabs can view the same session
- State (windows, workspaces) preserved across reconnections
- Integrates with
tuios ls,tuios attach, and other session commands
- Terminal size uses minimum of all connected client dimensions
- State changes broadcast to all clients in real-time
- Clients notified when others join/leave
TUIOS Flags
All TUIOS flags are forwarded to the spawned instance:Client Settings
Click the ⚙ button in the browser to access:- Transport: Auto, WebTransport, or WebSocket
- Renderer: Auto, WebGL, Canvas, or DOM
- Font Size: 10-24px
Transport Protocols
WebTransport (QUIC)
- Port: HTTP port + 1 (default: 7682)
- Protocol: HTTP/3 over QUIC (UDP)
- Benefits: Lower latency, better multiplexing, connection migration
- Requirements: Chrome 97+, Edge 97+, or compatible browser
serverCertificateHashes for development. Certificates are valid for 10 days (Chrome requirement).
WebSocket (Fallback)
- Port: Same as HTTP (default: 7681)
- Protocol: WebSocket over TCP
- Benefits: Universal browser support
- Used when: WebTransport unavailable or explicitly selected
Rendering
WebGL (Default)
GPU-accelerated rendering using xterm.js WebGL addon:- Smooth 60fps scrolling and updates
- Lower CPU usage
- Hardware-accelerated text rendering
Canvas (Fallback)
2D canvas rendering:- Good performance on most devices
- Used when WebGL unavailable or context lost
DOM (Fallback)
Standard DOM-based rendering:- Most compatible option
- Higher CPU usage
- Used when Canvas addon unavailable
Examples
Example 1: Personal Web Access
Example 2: Shared Session for Team
Example 3: Demo/Presentation Mode
Example 4: Custom Theme for Web
Performance
Server Optimizations
- Buffer Pools: Reusable buffers reduce GC pressure
- Atomic Counters: Lock-free connection counting
- Direct Streaming: No intermediate buffering for PTY output
- Structured Logging: charmbracelet/log with configurable levels
Client Optimizations
- requestAnimationFrame Batching: Terminal writes batched per frame
- Mouse Deduplication: Only sends events when cell position changes
- Pre-allocated Buffers: Reusable send/receive buffers
- Cached DOM Elements: No repeated querySelector calls
Typical Performance
| Metric | Value |
|---|---|
| Latency (local) | Less than 5ms |
| Latency (LAN) | Less than 20ms |
| Mouse events filtered | 80-95% |
| Memory (per session) | ~10MB |
Security
Certificate Handling
For development, TUIOS generates a self-signed ECDSA P-256 certificate:- Valid for 10 days (Chrome WebTransport requirement)
- Hash provided via
/cert-hashendpoint - No browser certificate warning needed for WebTransport
Production Recommendations
- Use a reverse proxy (nginx, Caddy) with proper TLS
- Set
--host 127.0.0.1and proxy external traffic - Use
--max-connectionsto limit resource usage - Consider
--read-onlyfor public demos
CORS
All origins allowed by default. For production, configureAllowOrigins in the server config.
Troubleshooting
WebTransport Not Connecting
- Check browser support (Chrome 97+)
- Verify UDP port 7682 is accessible
- Check console for certificate hash errors
- Try forcing WebSocket in settings
Blank Terminal
- Check browser console for errors
- Verify fonts loaded (
document.fonts.check()) - Try switching renderer in settings
- Check if TUIOS process started (server logs)
High Latency
- Check network conditions
- Prefer WebTransport over WebSocket
- Use WebGL renderer for smoother updates
- Check server CPU usage
Session Not Closing
If pressingq doesn’t close the web session:
- Server sends
MsgClosewhen PTY exits - Check for browser console errors
- Verify session cleanup in server logs
Debug Mode
- Connection attempts and session lifecycle
- Bytes sent/received per session
- Terminal resize events
- Error details
See Also
- SSH Server - SSH-based remote access
- Session Management - Managing TUIOS sessions
- CLI Reference - Complete web command reference
- Sip Library - Serve any Bubble Tea app in the browser