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(agnostification): agnostify web socket connections #6520
Conversation
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.
LGTM with nits.
const getWebSocketTransportClass = async () => { | ||
return isNode | ||
? (await import('../node/NodeWebSocketTransport.js')).NodeWebSocketTransport | ||
: (await import('./BrowserWebSocketTransport.js')) |
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.
Does there need to be a subdirectory for browser-centric code?
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.
Yeah, I think probably there does. But then it'll get a bit messy with node/browser/common where common will sometimes conditionally load in things. But maybe that's fine?
I might leave this for a follow up PR - let me know if you feel strongly to fix this now 👍
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.
I don't personally think it's a blocker if you're planning to do it anyway.
@@ -22,7 +22,7 @@ import { assert } from '../common/assert.js'; | |||
import { helper, debugError } from '../common/helper.js'; | |||
import { LaunchOptions } from './LaunchOptions.js'; | |||
import { Connection } from '../common/Connection.js'; | |||
import { WebSocketTransport } from '../common/WebSocketTransport.js'; | |||
import { NodeWebSocketTransport as WebSocketTransport } from '../node/NodeWebSocketTransport.js'; |
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.
Do you want to rename the import? Might be better to refactor it to use the new name.
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.
Yeah, I think so. Will rework in follow-up.
This PR updates the socket transport code to swap between a Node web socket transport or a web one based on the `isNode` environment. It also adds unit tests to the browser tests that show we can connect in a browser.
b937bf4
to
66ac8e2
Compare
This PR updates the socket transport code to swap between a Node web socket transport or a web one based on
isNode
. It also adds unit tests to the browser tests that show we can connect in a browser.