core icon indicating copy to clipboard operation
core copied to clipboard

JSON Flush

Open userlip opened this issue 6 years ago • 3 comments

Hey,

is it possible to use the Flight::json() function with flushing?

So I can call Flight::json() then the user gets a response but the script still runs after sending the data.

I tried normal flushing of content without Flight::json but that does not seem to work when using this framework 😬

userlip avatar Jul 08 '18 17:07 userlip

The json method will always send a response, but the script will still keep running until it calls stop. So you can just add a filter Flight::before('stop', ...) to run some code before the script exits.

mikecao avatar Jul 16 '18 06:07 mikecao

Yes, but what if I have a long task to do (Like video editing) then I don’t want the user to wait the whole time until his video is done editing.

Thanks

Am 16.07.2018 um 08:46 schrieb Mike Cao [email protected]:

The json method will always send a response, but the script will still keep running until it calls stop. So you can just add a filter Flight::before('stop', ...) to run some code before the script exits.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mikecao/flight/issues/374#issuecomment-405160719, or mute the thread https://github.com/notifications/unsubscribe-auth/AS78wtqxhs5SIfytYQRGJ5K2ChNbAj_7ks5uHDbCgaJpZM4VGy_3.

userlip avatar Jul 17 '18 08:07 userlip

See: https://github.com/mikecao/flight/issues/413

It seems that you CAN accomplish non-buffering in a route

mfrederico avatar Jun 12 '20 17:06 mfrederico

Seems addressed

n0nag0n avatar Jan 03 '24 21:01 n0nag0n