-
Notifications
You must be signed in to change notification settings - Fork 161
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
Reuse Nuxt's WebSocket #112
Comments
I believe the second port (either the vite or custom port we are currently using for devtools) would share the same issues for remote sharing and docker as it needs extra configuration in the Nuxt setup. Also even though vite is the default builder, design-wise Nuxt shouldn't depend its ecosystem and DX directly on a specific bundler (this way we can introduce new bundlers without huge migration costs like Nuxt 2 to Nuxt 3) Working on a new nuxi dev server to implement a similar layer for shared WS listening on the same port of Nuxt and it keeps alive across Nuxt/Nitro/Builder restarts. Maybe it is something we could work on together. |
That sounds great if Nuxt itself is going to have a WS server 👍. Changed the title |
I've spend considerable time figuring out websockets on nuxt a week ago, please have a look at: nuxt/nuxt#19230 My proposal would be: untangle the whole websocket stuff from nuxt core/vite and just put a proxy in front of nuxt for your websocket needs. This fixes all docker port sharing issues and you have full control that the HTTP UPGRADE comand works. |
Co-authored-by: Renovate Bot <[email protected]>
I think it's related.. I just got "WebSocket disconnected" just after installing and enabled the nuxt3-socket.io module. |
Currently, we are creating a new WS entry to do server-client communication:
devtools/packages/devtools/src/module-main.ts
Lines 58 to 59 in 703b69a
Since Nuxt DevTools is relying on Vite (I see in the near future, we probably only support Vite), I guess reusing Vite's WS would make things more efficient and stable. As Vite has the capability of handling custom events now: vitejs/vite#7437
This could potentially solve the connection issue in back-proxy or dockers, as Vite handles them well. Also could align with the approaches of vite-plugin-inspect etc.
/cc @pi0 you mentioned previously about reusing WS from Nitro, do you think it's still a thing, and what's your opinion on choosing which over which?
The text was updated successfully, but these errors were encountered: