Skip to content

Various fixes#35

Merged
erikdred merged 3 commits into
mainfrom
various-fixes
Jun 12, 2026
Merged

Various fixes#35
erikdred merged 3 commits into
mainfrom
various-fixes

Conversation

@ndorin

@ndorin ndorin commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This pull request enhances the application's WebSocket connection logic by adding support for a fallback URL when connecting to a debug session. It also improves error reporting by tracking all failed connection attempts, and updates the UI to inform users about multiple failed certificate URLs that may need to be trusted.

WebSocket Connection Handling:

  • The join function in App.tsx now supports a fallbackUrl for WebSocket connections, prioritizing fallbackUrl if available and passing both URLs to the connection logic. [1] [2]
  • The WebSocket middleware (websocketMiddleware.ts) has been refactored to attempt connecting to the primary URL first, and automatically fall back to the secondary URL if the primary fails. All attempted URLs are reported on failure. [1] [2] [3]

Error Reporting and State Management:

  • The Redux state now tracks an array of failed URLs (failedUrls) instead of a single URL, allowing the UI to display all failed connection attempts. [1] [2] [3]

User Interface Improvements:

  • The DebugConsole component now displays all URLs with failed certificate connections, providing users with direct links to accept certificates for each failed attempt. [1] [2]

Copilot AI review requested due to automatic review settings June 12, 2026 21:10
@ndorin ndorin requested a review from erikdred June 12, 2026 21:11

@erikdred erikdred left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved!

@erikdred erikdred merged commit 4655221 into main Jun 12, 2026
3 checks passed
@erikdred erikdred deleted the various-fixes branch June 12, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the debug-session WebSocket connection flow to support trying an alternate URL, surfaces all attempted connection URLs when connection ultimately fails, and updates the Debug Console UI to present multiple certificate-trust links when needed.

Changes:

  • Added fallbackUrl support to debug session responses and to the WS_CONNECT action payload.
  • Refactored WebSocket middleware to attempt a secondary URL and to report all attempted URLs on failure.
  • Updated Redux state + Debug Console UI to track and render multiple failed certificate URLs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/store/websocketSlice.ts Changes websocket state from a single failedUrl to failedUrls[], and extends connect action payload to include fallbackUrl.
src/store/websocketMiddleware.ts Implements primary/fallback connection attempts and dispatches a list of attempted URLs on failure.
src/store/apiSlice.ts Extends DebugSession type to optionally include fallbackUrl.
src/features/DebugConsole/DebugConsole.tsx Renders multiple certificate acceptance links based on failedUrls.
src/App.tsx Passes both primary and fallback URLs into the WS connection action when joining a debug session.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +33 to +51
socket = new WebSocket(targetUrl);
socket.onopen = () => store.dispatch(connected());
socket.onclose = () => {
store.dispatch(disconnected());
socket = null;
};
socket.onerror = (err) => {
console.error("WebSocket error", err);
if (fallback) {
console.log("[ws] Primary connection failed, falling back to", fallback);
connectToUrl(fallback);
} else {
// Report all attempted URLs (primary + fallback that was tried)
const attemptedUrls = fallbackUrl && targetUrl === fallbackUrl
? [url, fallbackUrl]
: [targetUrl];
store.dispatch(connectionFailed(attemptedUrls));
}
};
Comment on lines +30 to 32
const certUrls = failedUrls
? failedUrls.map((u: string) => new URL(u).origin.replace(/^wss:/, 'https:').replace(/^ws:/, 'http:'))
: null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants