On Monday, December 3, 2018 at 10:49:40 AM UTC-5, Jay McCarthy wrote:
>
> > I don't know if the Racket web server (or related libraries) currently 
> provide a way to stream data in the response, but that is something I'll 
> definitely need relatively soon (primarily for streaming large CSV/JSON 
> files). If it doesn't exist, I don't mind writing it, but I also don't want 
> to begin with an approach now that might make adding that capability more 
> difficult later. From my brief research, given the output field of the 
> response struct is a lambda, I think I can stream using that (i.e. return a 
> lambda in the response immediately that begins writing the data as it 
> retrieves it) - hopefully the infrastructure doesn't buffer the entire 
> output. Other than something like that, I'm happy to work mostly at the 
> level of functions from requests to responses. 
>
> The reason why responses have the lambda rather than a byte string is 
> specifically for streaming like you want. Make sure you specify the 
> correct response size in the headers. 


Jay, are you sure it's necessary to specify the correct response size in 
the headers? This would be extremely inconvenient in a streaming response 
scenario. I looked at some similar code in a Rails project, and it appears 
I'm only setting Last-Modified, Content-Disposition and Content-Type 
headers.

Yes, I know this is an old thread, but I'm just now having to stream some 
CSV files from the web app :) 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/995deb39-16f7-432e-8931-3bbae4d86bb7%40googlegroups.com.

Reply via email to