webpack-dev-server
webpack-dev-server copied to clipboard
Sockjs live reloading migration from v3 to v4 unclear
Documentation Is:
- [x] Missing
Please Explain in Detail...
Webpack-dev-server config options migration from v3 to v4 is not clear with regards to changes to websocket options; particularly when using sockjs protocol, given the new defaulting to the ws protocol.
When the sockjs protocol is provided in options, the SockJS server is bound to the '/ws' path.
This is fixed by adding the webSocketServer options as such:
webSocketServer: {
type: 'sockjs',
options: {
path: '/sockjs-node'
}
}
Your Proposal for Changes
This should be communicated in docs, or the defaultWebSocketServerOptions in lib/Server.js [line 1517] currently:
const defaultWebSocketServerOptions = { path: '/ws' }
should have the path be equal to client.webSocketURL or client.webSocketURL.pathname
Socksjs supports ws and versa vice too, it was replaced in runtime based on supporting
Thanks @alexander-akait, does this need to be documented here https://webpack.js.org/configuration/dev-server/#websocketurl so that the developer knows that the path needs to either be '/ws', or they must set it under webSocketServer.options.path?
Based on your configuration, if you have before non default options, you need to update, but if you don't change it, you can don't touch it and all will work
Alright, if it doesn't warrant a docs update, happy if we close the issue!
@WisaniShilumani We can improve docs, so feel free to send a PR, any docs updates are good for developers
Thanks @alexander-akait I will open a PR shortly!
Closing due to inactivity. Anyway feel free to send a PR. Thanks!