nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Nitropack dev server breaks all websocket connection

Open mmis1000 opened this issue 1 year ago • 1 comments

Environment

Nitropack: 0.4.24 Node: v14.18.2

Reproduction

Try to listen to a websocket in the server and run the server via nitropack dev server

Describe the bug

No websocket works

  • I am using Nuxt3 RC8. And I noticed no websocket works when I am running nuxt dev. But it works totally fine when I am running the prod version

Additional context

You need additional setup to make http-proxy package works with websocket. Some important setup was missed here https://github.com/unjs/nitro/blob/main/src/dev/server.ts#L135

See also: Handling done by http-proxy-middleware https://github.com/chimurai/http-proxy-middleware/blob/2.x/src/http-proxy-middleware.ts#L70 https://github.com/chimurai/http-proxy-middleware/blob/2.x/src/http-proxy-middleware.ts#L80-L83 https://github.com/chimurai/http-proxy-middleware/blob/2.x/src/http-proxy-middleware.ts#L86-L93

Logs

No response

mmis1000 avatar Sep 05 '22 02:09 mmis1000

You are right. Currently Nitro does not supports websockets. Working on it.

pi0 avatar Sep 05 '22 07:09 pi0