-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ui): decouple TestServerConnection from websocket transport #32274
chore(ui): decouple TestServerConnection from websocket transport #32274
Conversation
@@ -19,6 +19,16 @@ import * as events from './events'; | |||
|
|||
// -- Reuse boundary -- Everything below this line is reused in the vscode extension. | |||
|
|||
export interface TestServerSocket { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We usually call things like this one "Transport" for easier search across the codebase.
- This is a somewhat convoluted interface for a transport. Perhaps we should separate transport (onmessage, onclose, send, close) from a factory that creates a websocket transport (this one needs open/error/etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! How do you like 0f37e55?
@@ -102,7 +102,7 @@ export const WorkbenchLoader: React.FunctionComponent<{ | |||
const guid = new URLSearchParams(window.location.search).get('ws'); | |||
const wsURL = new URL(`../${guid}`, window.location.toString()); | |||
wsURL.protocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:'); | |||
const testServerConnection = new TestServerConnection(wsURL.toString()); | |||
const testServerConnection = new TestServerConnection(new WebSocket(wsURL)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const guid = new URLSearchParams(window.location.search).get('ws');
const wsURL = new URL(`../${guid}`, window.location.toString());
wsURL.protocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:');
const testServerConnection = new TestServerConnection(new WebSocket(wsURL));
this code is also used in packages/trace-viewer/src/ui/uiModeView.tsx
consider extracting to a utility function
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"1 flaky30097 passed, 870 skipped Merge workflow run. |
Preparation for #32076.