-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
refactor: union public/client.host/client.port/client.path
#3181
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
Conversation
lib/utils/DevServerPlugin.js
Outdated
|
|
||
| console.log(domain); |
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.
| console.log(domain); |
|
Also, we need to remove webpack-dev-server/bin/cli-flags.js Line 234 in c4279c2
|
|
Yep, still WIP, we need more things here |
|
@snitin315 I think maybe we need to use |
|
Yes, let's go with |
|
We need fix line https://github.com/webpack/webpack-cli/blob/master/packages/serve/src/startDevServer.ts#L77 in |
I will take care of it |
| if (hostname === publicHostname) { | ||
| return true; | ||
| } | ||
| } |
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 have mixed logic for proxied server and socket url, it is weird, when you proxy dev server you need specify host in firewall
|
|
||
| this.socket.installHandlers(this.server.server, { | ||
| prefix: this.server.options.client.path, | ||
| prefix: '/ws', |
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.
Will be improved in future (in the next PR)
| this.wsServer = new ws.Server({ | ||
| noServer: true, | ||
| path: this.server.options.client.path, | ||
| path: '/ws', |
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.
Will be improved in future (in the next PR)
| it('responds with a 200 second', (done) => { | ||
| req.get(path).expect(200, done); | ||
| }); | ||
| }); |
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.
unnecessary test, we already have tests in e2e
|
Maybe: {
client: {
websocketTransport:
'ws' |
'sockjs' |
{
client: { type: 'ws' | string, options: Record<any, any> },
server: { type: 'ws' | string, options: Record<any, any> }
}
}
}Allow to set options for websocket server: {
client: {
websocketTransport: {
client: {
// type: 'ws', can be omitted, because default value is `ws`
options: { socketUrl: 'ws://dev.site/custom' }
},
server: {
// type: 'ws', can be omitted, because default value is `ws`
options: { path: '/custom' }
}
}
}
}But multiple |
|
Done here #3309 |
For Bugs and Features; did you add new tests?
Shortly - union
public/client.host/client.port/client.pathintoclient.webSocketUrlfixes #3169
Motivation / Use-Case
Better DX, simplify logic
Breaking Changes
Yes, options was removed, also you need put
firewall: ['domain.com']when your proxy dev server (always)Additional Info
Possible values:
webSocketUrl: 'ws://0.0.0.0:0/ws'- full specified URL,0.0.0.0for usingself.location.hostname,:0for usingself.location.portwebSocketUrl: 'wss://192.168.0.1:8082/custom'- wss, custom hostname, custom port and custom pathnameSummary:
0.0.0.0,self.location.hostnamewill be used:0or don't specify it,self.location.portwill be usedpathnameis/ws, we will improve supporting in future, if you don'tpathname/wswill be used by default