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

WebSocket disconnect event #349

Closed
Kludex opened this issue Oct 29, 2022 · 2 comments
Closed

WebSocket disconnect event #349

Kludex opened this issue Oct 29, 2022 · 2 comments

Comments

@Kludex
Copy link
Contributor

Kludex commented Oct 29, 2022

Hi there 👋

I need help. 👀

Let's assume that our client sent some data, the server was able to receive that data, and it's about to send that to the application. In the meantime, the application sent a close message.

What do I do with the data that just arrived?

Motivation comes from encode/uvicorn#1619.

@andrewgodwin
Copy link
Member

I mean this is a classic race condition - it depends. I'd say that it's probably more expected to not send it to the application and just drop it - while you could argue what the spec says or doesn't here, there's never a guarantee you'll receive data anyway and dropping it is much less surprising than trying to serve the application data after it's asked to close.

@Kludex
Copy link
Contributor Author

Kludex commented Oct 29, 2022

I had the same thoughts. I'll comply with that reasoning on uvicorn - which is basically continuing with the current behavior.

As always, much appreciated. Thanks @andrewgodwin 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants