Skip to content
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

Server sends invalid websocket frame: RSV1 must be clear #408

Closed
mStirner opened this issue Jan 12, 2024 · 0 comments
Closed

Server sends invalid websocket frame: RSV1 must be clear #408

mStirner opened this issue Jan 12, 2024 · 0 comments
Labels
bug Something that should not be like that http api

Comments

@mStirner
Copy link
Member

Seems like this happens after using newer node version than 16.
On v20.11.0, this happens when the "Detect broken connections" is enabled.

See:

Reason for that is how the websocket upgraded is handled.
Instead of listen for the upgrade event, the upgrade is done in the request event.

After handling the upgrade event, it seems the problem is solved.
Test and add the following code to the http servers:

server.on("upgrade", (req, socket, head) => {

    let res = new http.ServerResponse(req);
    res.assignSocket(socket)

    res.on("finish", () => {
        res.socket.destroy();
    });

    app(req, res);

});
@mStirner mStirner added bug Something that should not be like that http api labels Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that should not be like that http api
Projects
None yet
Development

No branches or pull requests

1 participant