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

Always flush() between write and read #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vin
Copy link

@vin vin commented Nov 16, 2024

Messages received after started were not being flushed until the very last message (when not more_body).

Instead, we should always flush() between a write and a read.

Without this, we were observing behavior that didn't work for server-sent events: the first message would be delivered immediately, and then all subsequent messages would be delivered all in one go when the last message arrives.

See similar change in GZIpMiddleware at encode/starlette#2753

Messages received after `started` were not being flushed until the very last message (when `not more_body`).

Instead, we should always flush() between a write and a read.

Without this, we were observing behavior that didn't work for server-sent events: the first message would be delivered immediately, and then all subsequent messages would be delivered all in one go when the last message arrives.
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

Successfully merging this pull request may close these issues.

1 participant