Skip to content

Feature Request: Auto-reconnect WebSocket on connection loss #262

@ryuzo-k

Description

@ryuzo-k

Problem

The Control UI WebSocket connection occasionally drops and doesn't automatically reconnect. Users have to manually refresh the page to restore the connection. This can be frustrating when the connection drops mid-conversation.

Current Behavior

  • WebSocket disconnects (network issues, idle timeout, etc.)
  • UI shows disconnected state
  • User must manually refresh the page

Desired Behavior

  • Detect WebSocket disconnection
  • Automatically attempt to reconnect with exponential backoff
  • Show reconnecting status to user
  • Resume session seamlessly without page reload

Suggested Implementation

Add reconnection logic to BrowserWebSocketTransport:

// On close, attempt reconnect
ws.addEventListener("close", () => {
  setTimeout(() => reconnect(), reconnectInterval);
  reconnectInterval = Math.min(reconnectInterval * 2, 30000);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions