Skip to content

bug: ttyd web terminal reconnect loop on mobile browsers #88

Description

@itscooleric

Problem

The ttyd web terminal (both standalone at clide's port and embedded in clem's Terminal tab) enters an infinite reconnect loop on mobile browsers. The terminal never renders — just keeps trying to connect.

Affects:

  • Direct access to clide ttyd (e.g. http://forge-edge:7681)
  • Clide embedded in clem's Terminal section via iframe
  • clidestable stall terminals (ttyd iframes)

Likely causes

  1. WebSocket connection dropped by mobile browser — mobile browsers aggressively kill background WebSocket connections, and ttyd's xterm.js reconnect logic enters a tight loop
  2. Viewport/resize issues — xterm.js may fail to initialize when the terminal viewport is too small or when the iframe hasn't fully rendered
  3. ttyd --reconnect setting — currently set to reconnect=3 (3 second retry), which on mobile creates a visible loop

Investigation needed

  • Check if ttyd works on mobile without an iframe (direct URL)
  • Check if it's specific to iOS Safari vs Android Chrome
  • Test with --reconnect=0 (disable auto-reconnect)
  • Test with ttyd's --client-option for mobile-specific settings
  • Consider a polling-based fallback for mobile (like clidestable's log viewer approach)

Workaround

Use the log viewer / activity log approach instead of ttyd on mobile. clidestable's /log/<name> page works on mobile since it's plain HTTP polling.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions