Skip to content

Reuse Nuxt's WebSocket #112

@antfu

Description

@antfu

Currently, we are creating a new WS entry to do server-client communication:

server.middlewares.use(ROUTE_ENTRY, tinyws() as any)
server.middlewares.use(ROUTE_ENTRY, rpcMiddleware as any)

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions