-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Add server.hmr.retry to solve frequent refresh caused by HMR WebSocket connection loss #6089
Comments
…used by HMR WebSocket connection loss (vitejs#6089)
This problem doesn't just happen on connection loss, it can also happen when a client doesn't have websocket enabled or doesn't support websocket. In that case, the client browser will perform many page refreshes per second on the server immediately after the first page load, which can cause a hit on the server. A reason why a client may disable websocket, is security. Websocket makes it possible for remote sites to perform local portscans at clients: https://nullsweep.com/why-is-this-website-port-scanning-me/ This page reload problem is also reported here: sveltejs/kit#3325 |
How did you @zhengjiaqi fix the problem temporarily ? You meant update it on the browser or did you find a way to override this code ? issue is affecting my project |
@clement4saunier |
Aha, #547 (comment) should be caused by this. |
Clear and concise description of the problem
Currently vite will reload the page after the HMR ws link is lost.
In some cases, it may cause frequent page reloads.
In my case,In a hybrid app,we need to use a proxy to avoid domain name restrictions,this will cause the HMR WebSocket connection loss (This is our mistake, and I am trying to solve it),but this cause frequent page reloads.
Like this:
We comment out
location.reload()
invite/dist/client/client.mjs
to temporarily solve this problem.And I found that others have encountered the same problem #5675
Suggested solution
There may be two ways to solve it:
server.hmr.retry
configuration to manually control whether to retry when the HMR WebSocket connection fails.For option 2, I will provide a pr(#6090), the preview is like this:
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: