-
-
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
feat: show ws connection error and don't reload if ws connection did not success #9007
Conversation
✅ Deploy Preview for vite-docs-main canceled.
|
Would the auto-reconnect feature of Vite still work after this PR? (I think this isn't an accidental feature, no?) Scenario:
|
Yes, it still works with that scenario. Once websocket's vite/packages/vite/src/client/client.ts Lines 78 to 101 in 07543af
|
One scenario that will no longer work is:
|
Should we retry a few times so that scenario keeps working? |
I don't think we need to support this scenario. I didn't come up with an actual situation that this scenario will happen. Vite starts server and ws server at the same time. So when |
Is this the scenario where someone is using Nodemon to restart whole server? Because I have situation where Nodemon performs restarts, Vite loses WebSocket connection, and if it doesn’t find it again (e.g. Nodemon hasn’t started new application fast enough), page gets reloaded. It would be nice to somehow either prevent reload, or try to ping for WebSocket connection few more times to prevent page reload. |
@sapphi-red any pointers on what needs to be done to implement this? |
@sapphi-red Hello, could there possibly be a reason why this fallback works for Chrome but not on Firefox/Safari? I deployed a vite server but for some reasons websocket doesn't work. Then on chrome I can see the error messages, but for Firefox/Safari the page keeps reloading. |
@zanetarock Without a reproduction, I don't know. Please create an issue. |
@sapphi-red Unfortunately this is not working with WebKit-based hybrid apps. |
@aparajita please create a new bug report so we can properly track the issue, you can link to this PR in it. A comment on an old merged PR would probably end up lost quickly. |
Description
#8650 introduced a fallback mechanism when the connection did not success.
This PR uses that to prevent reload if ws connection did not success.
Also this PR adds an error output when that happened.
fixes #8861 (because this PR will prevent reload if ws did not connect)
fixes #6089, close #6090 (because this PR will prevent reload if ws did not connect)
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).