-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
ASGI: Add affordances and recipe for long-polling #1808
Comments
Having some way to signal In addition, should we add some request status attributes, as we have for |
Use cases we will need to address and document:
Potential affordances:
|
Note: 3.0 behavior is to truncate the request body in the case of a premature disconnect. Mitigation is for apps to always validate their inputs! |
The current behaviour is somewhat awkward in the SSE scenario from the client perspective. Right now, it's possible to wrap the emitter's loop in a But not sure if it is a particularly elegant/recommended way to do it, and if it is, we should document recipes for that. |
OK, so looks like we need to improve the SSE disconnect story, and overall we will need some recipes for SSE, WebSocket, and good-old-fashioned long polling. |
When using as async generator in conjunction with if hasattr(stream, 'close'):
await stream.close() Maybe the something similar could be supported for the SSE generator too? |
The 3.0 ASGI implementation already affords long-polling, but it would be useful to provide a recipe to demonstrate the pattern in the context of a Falcon app.
Also, for the sake of efficiency, we may want to provide a
req.wait_disconnect()
or similar method that can be executed in a background task within a responder. The responder could then use this in order to detect if it should abandon a long-poll early in the case that the client bails out. This is similar to whatasgi.App
does when streaming SSE's (usingwatch_disconnect()
.The text was updated successfully, but these errors were encountered: