-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Possible fix for webpackHotDevClient disconnecting from server. #8091
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
Comments
Hi @gamedev8. You say others were experiencing issues? Would you mind providing a link for reference? |
I am experiencing the same issue. If I don't make any code edits, the dev server web socket connection times out after 5 minutes. Is this related to the switch to native |
Every websocket connection should have a keepalive to prevent firewalls from terminating the connection unexpectedly because they think it's "idle". Sockjs defaults it to one ping from server to client every 25s which seems like a good default to me. |
It would seem that a fix is more appropriate in webpack-dev-server if that's the current behavior of sockjs which webpack uses by default (and is transitioning to WS default in next major). sockjs-node code for reference: https://github.com/sockjs/sockjs-node/blob/4c9f3009be13962b0785138ccdf527c5abe925f6/lib/transport/websocket.js#L74-L82 |
That sounds reasonable regarding where the fix should go, though in the meantime, is the intent to stick with the current settings in CRA and wait out a change in webpack-dev-server? Love some of the updates in CRA 3.3.0, but am resorting to manually patching the dev server locally to get around the disconnects (which does work for me) rather than pinning back. |
We upgraded to the WS implementation to fix some other issues, so i doubt we'll be going back to the legacy sockjs implementation as WS is the path forward. If webpack-dev-server isn't responsive we can potentially patch things up in CRA to help. I created an upstream issue at webpack/webpack-dev-server#2403. |
Hey @ianschmitz There is an important flaw with the code I posted and any kind of heartbeat implementation - When you are stepping through your code the browser is tying up your whole application, so the client and server will not be able to communicate... and eventually time out. So IMHO a better solution is for the server to somehow not timeout the client, or for the client to automatically reconnect. |
Agreed. I'm hopeful we can get this fixed upstream. |
Looks like the server side socket logic has been improved in WDS. Would be great if someone can test their fix to see if it closes this issue. |
The changes are not working for me. It still times out after 60 seconds. I upgraded my |
We pin the version of webpack-dev-server, so you've likely just installed another version in your tree that isn't being used. You can try yarn resolutions. |
I had deleted the |
Yeah that's not gonna work. Try |
Hello I would like to submit a fix for the issue people are having with the websocket in webpackHotDevClient.js disconnecting from the server. The websocket is timing out after some time, so we simply ping the server periodically to prevent it from timing out. Here is the code I've been using.
I have a branch ready here. I can submit a PR.
https://github.com/vibelife/create-react-app/blob/master/packages/react-dev-utils/webpackHotDevClient.js#L85
The text was updated successfully, but these errors were encountered: