Fix Broken Socket on Client for Custom/Random Port Numbers #1060
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.
What kind of change does this PR introduce?
Bugfix
Did you add or update the
examples/
?No need
Summary
#1059 exposed a situation in which the sockjs url for clients with custom/random ports would result in the client using an erroneous url that either omitted the port or used the wrong (default 8080) port. This resulted in socket communication breaking, which was noticed by way of the lack of an overlay being displayed.
This fix does the following:
Server.js
the socket server won't be initialized nor started until thelisteningApp
triggers the callback onlisten
. That's really the proper time for the socket server to be initialized anyhow. polyfills dep is also moved to the top to matchbin/webpack-dev-server.js
.client/index.js
the port parsing is going to look fornull
and'0'
onurlParts.port
and that'll be refactored slightly.bin/webpack-dev-server.js
the polyfills dep is added to the top of the file preventinginternal-ip
errors on Node 4.x.Does this PR introduce a breaking change?
Negatory
Other information