-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle abnormal WebSocket close on client (fixes #114) #140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! The change looks good and is correct! I've left some comments - once resolved we can merge and release a new version. About your application - I've flagged it with the team!
Thanks for the review, glad to hear my changes were correct for the most part! I've addressed the requested changes:
Happy to knock out #66 too if how I implemented dynamic port assignment in my tests looks good, although it looks like port assignments are hardcoded in tests other than |
This all looks really good! Thank you! I made some notes in #66 , let's continue the discussion there. |
Modified the WebSocket Stream to insert the control frame
closed: 1006
when a client tries to read from a stream after it's been abnormally closed by the server.In my implementation, 'abnormally closed' means the underlying TCP stream was closed without the WebSocket-level closing handshake (we get an
io.EOF
). I admit I am newer to working with WebSockets on this low of a level, so there may be other cases we need to check.Previously, tests (and presumably library users) would expect to receive this
io.EOF
error from methods likenextFrame()
after the connection was abnormally closed, so I maintain this behavior while also returning the aforementioned control frame.I've also added tests to check correct client behavior on abnormal server close for both synchronous and asynchronous stream methods.
Separately, I recently applied for Talos’s backend internship position. If this is a helpful fix maybe you can look at my application :) It should be under Maxim Maeder / [email protected]