-
-
Notifications
You must be signed in to change notification settings - Fork 754
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 shutdown event in Websocket Implementations #1738
Conversation
Current
Ref: https://www.rfc-editor.org/rfc/rfc6455#section-7.4.1 This implies in websockets implementation, connections are not gracefully closed when the server is shutdown. |
As per MDN even 1012 is wrong. The right response code should be 1001. |
See django/asgiref#340 for |
So 1005 then? There is already a PR, but that is for disconnect. Is it the same for shutdown? |
# Conflicts: # tests/protocols/test_websocket.py
self.transport.close() | ||
task = asyncio.create_task(self.close(code=1012)) | ||
task.add_done_callback(self.on_task_complete) | ||
self.tasks.add(task) | ||
|
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.
Help needed here.
self.transport.close()
causes unexpected closure of connection at this place. However the transport is getting closed at a later stage. Is this okay?
I've added the tests for |
Ok, cool! I'll close this PR then. |
No description provided.