Skip to content
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 handle compression #2010

Closed
3 tasks
Reprevise opened this issue Oct 24, 2023 · 3 comments
Closed
3 tasks

How to handle compression #2010

Reprevise opened this issue Oct 24, 2023 · 3 comments
Labels
i: wontfix This will not be worked on

Comments

@Reprevise
Copy link
Contributor

Reprevise commented Oct 24, 2023

Request Statement

Today, we ran into an issue of Cloudflare that had them sending erroneous content-encoding headers to our mobile app. It got us thinking about how compression should be handled. Right now, Dio doesn't do any decompression on its own.

The goal of this issue is to see the following compressions supported in Dio:

  • gzip
  • br
  • deflate

Solution Brainstorm

I'm not sure what the best way to go about it is, especially with Brotli as there are a couple of community libraries, but one has some issues and the other is built on FFI with other compression formats that are unnecessary. Dart already has gzip support but it's inside of dart:io.

Another question is, should this be on the main thread? Preferably if its large enough, it would be offloaded to another thread in native implementations, but I'd like to see that configurable as it is with the jsonDecodeCallback, mostly because we have long-running worker threads in our app and we'd like to put the work on that instead of running compute or Isolate.run() and waste time spinning up a new isolate.

@Reprevise Reprevise added the s: feature This issue indicates a feature request label Oct 24, 2023
@AlexV525
Copy link
Member

AlexV525 commented Oct 25, 2023

GZIP decoding should be available already?

@Reprevise
Copy link
Contributor Author

GZIP decoding should be available already?

Ah apologies, totally overlooked that. I think it's better off that I close this issue in favor of the other Brotli feature request ones then.

@AlexV525 AlexV525 added i: wontfix This will not be worked on and removed s: feature This issue indicates a feature request labels Nov 13, 2023
@francosang
Copy link

Hey @AlexV525 !

Regarding the other question:

Another question is, should this be on the main thread? Preferably if its large enough, it would be offloaded to another thread in native implementations, but I'd like to see that configurable as it is with the jsonDecodeCallback, mostly because we have long-running worker threads in our app and we'd like to put the work on that instead of running compute or Isolate.run() and waste time spinning up a new isolate.

Do you know whether the decompression is blocking or happens in the background on Android/iOS?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i: wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants