You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support websocket connection to existing app/pages paths.
Non-Goals
No response
Background
We are developing an app that allows to proxy user requests (both HTTP and websocket) from next.js to an background web server (using http-proxy package). We are blocked by #55299 for months, and extremely glad to hear that #57245 has finally fixed it by adding back support for registering custom upgrade handler for server.
But currently it is disallowed to upgrade to existing app/pages paths.
// TODO: allow upgrade requests to pages/app paths?
// this was not previously supported
if(matchedOutput){
returnsocket.end()
}
Why adding this limitation? It makes the fix useless if there is an optional catch-all route, adds another source of errors that users using existing paths as websocket endpoints may encounter and spend hours to debug (the connection will be closed with code 1006 with no reason), but has no clear advantages IMO.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Support websocket connection to existing app/pages paths.
Non-Goals
No response
Background
We are developing an app that allows to proxy user requests (both HTTP and websocket) from next.js to an background web server (using http-proxy package). We are blocked by #55299 for months, and extremely glad to hear that #57245 has finally fixed it by adding back support for registering custom
upgrade
handler for server.But currently it is disallowed to upgrade to existing app/pages paths.
next.js/packages/next/src/server/lib/router-server.ts
Lines 596 to 600 in 2238696
Why adding this limitation? It makes the fix useless if there is an optional catch-all route, adds another source of errors that users using existing paths as websocket endpoints may encounter and spend hours to debug (the connection will be closed with code 1006 with no reason), but has no clear advantages IMO.
Proposal
Just remove the code.
Beta Was this translation helpful? Give feedback.
All reactions