-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(ws): Don't send two close frames #22684
base: main
Are you sure you want to change the base?
Conversation
@mmastrac could you check if this is the correct way to go about this? The gist is that the fastwebsockets crate responds with a close frame whenever it receives a close frame. But this includes when the websocket was closed from Deno's end. As a result, two close frames are sent and Chrome logs an error in the console. So basically what happens is:
This PR prevents any frames from being sent once the WebSocket is closed. But I worry this might be a bit too extreme. I tried fixing it in the fastwebsockets crate, but couldn't find an easy way to check whether the websocket was closed or not. Let me know if there's a better way to do this. And if not, I'll start adding tests. |
@jespertheend fastwebsocket has |
I think the bug is that we are not closing the TCP connection immediately after sending the close frame. https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.1
|
Ah I see, that makes sense. I'll look into that! |
Hah! Turns out this was a lot easier than I had expected. I was trying to find a way to pass the created TcpStream to fastwebsockets somehow, but it seems like calling |
I've submitted denoland/fastwebsockets#72 |
@littledivy can we update |
Once denoland/fastwebsockets#72 is fixed and merged, this PR would no longer be necessary. |
Fixes #21642