Various fixes#35
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
fallbackUrlsupport to debug session responses and to theWS_CONNECTaction 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
joinfunction inApp.tsxnow supports afallbackUrlfor WebSocket connections, prioritizingfallbackUrlif available and passing both URLs to the connection logic. [1] [2]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:
failedUrls) instead of a single URL, allowing the UI to display all failed connection attempts. [1] [2] [3]User Interface Improvements:
DebugConsolecomponent now displays all URLs with failed certificate connections, providing users with direct links to accept certificates for each failed attempt. [1] [2]