roadrunner-bundle icon indicating copy to clipboard operation
roadrunner-bundle copied to clipboard

Feat: support RR[>=2023.3] streamed responses

Open FluffyDiscord opened this issue 1 year ago • 8 comments

Fix #101

Added support for streaming for:

  • Symfony\Component\HttpFoundation\StreamedJsonResponse
  • Symfony\Component\HttpFoundation\StreamedResponse (partial, info bellow)
  • Symfony\Component\HttpFoundation\BinaryFileResponse

In this PR the StreamedResponse still loads eveything in memory if the provided callback is not a generator. The only solution to be fully compatible would be to save the content to temp file and then stream that file. Of course, now the issue could running out of space on storage, the read -> save -> read -> send overhead and waiting basically until the original callback finished and getting only half of the streamed response feature set.

More info here: https://roadrunner.dev/docs/http-resp-streaming/current/en

This is a breaking change for anyone using old RR, as they need to update the binary. Nothing else should be needed.

FluffyDiscord avatar Dec 03 '23 11:12 FluffyDiscord

@Baldinof are you still fully maitaining this repository? or you moved to different projects and now this is in maintenance-only mode?

FluffyDiscord avatar Dec 03 '23 11:12 FluffyDiscord

Hello @FluffyDiscord I'm still maintaining it, sorry if I've been late to respond!

I'll have look on all PRs this week.

Thanks for your contributions :)

Baldinof avatar Dec 03 '23 19:12 Baldinof

I think we should also add Spiral\RoadRunner\Http\Exception\StreamStoppedException to the list of default ignored exceptions as this can cause false reports. It should be handled by the generators that are added in this PR though.

FluffyDiscord avatar Dec 03 '23 20:12 FluffyDiscord

Any news here @FluffyDiscord Do you want me to take this PR over?

Baldinof avatar Jan 11 '24 10:01 Baldinof

Any news here @FluffyDiscord Do you want me to take this PR over?

Hi and sorry, I kind of forgot about this since I am using my fork. I think this should be it, for the changes. Now only tests should be missing. Let me know if theres anything else to do before the tests.

FluffyDiscord avatar Jan 11 '24 18:01 FluffyDiscord

Hey @FluffyDiscord / @Baldinof , any news on this?

L3tum avatar Feb 26 '24 14:02 L3tum

Hey @FluffyDiscord / @Baldinof , any news on this?

I have abandoned this package and made one myself. This PR can be either closed or finished by @Baldinof if he wants to.

FluffyDiscord avatar Feb 26 '24 15:02 FluffyDiscord

@FluffyDiscord Alright, I'll probably be looking into this in a few weeks in case you don't wanna take over @Baldinof . I can't promise anything yet, though

L3tum avatar Feb 26 '24 15:02 L3tum