-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to send response to client while streaming. #1153
Comments
Could you be more precise ? If you are asking about the streaming api of sanic here is the docs for it. |
@sourcepirate Yes i want to use streaming API for upload file from client and i also check that sanic streaming API. but my question is how we send response to client while processed every chunks..i.e "First chunk is save" for making connection between client and server. |
As per streaming API of sanic, It take whole request and then stream that request in body one by one, after completing that request send only one response to client. I want to use this for web application like file upload functionality, and get response for every stream while upload. |
I believe you could stream the request in chunks with |
If your question is about how to make client send in chunks of a file. You could refer to https://www.html5rocks.com/en/tutorials/file/filesystem/ |
@sourcepirate Thanks |
@sourcepirate,I want send a stream content to the client with the stream method because as per sanic response streaming, it stream all data in body and final send one response to client instead of send every stream. |
As I'm interpreting it, I think that the question is how to accept chunked streams and respond as those chunks complete. But I'm not 100% sure. |
As Sanic is "architectured" today, this might be possible with some knowledge of the inner protocols and stuff. The Sanic server waits for all chunks of the body to be completed prior to calling the request handler unless the same is a stream, so it would need to read the stream data instead of the body but, to send data (even if it's a |
Closing, thread has stagnated and requester has not added to comments since org move. |
Even if it were fixed, it would then face mypy bug with try/except conditional imports sanic-org#1153 python/mypy#1153
I need to know how we send response to client for every chunks in streaming to overcome timeout error.
The text was updated successfully, but these errors were encountered: