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

Allow using native HTTP #1989

Closed
1 task done
knaeckeKami opened this issue Jul 21, 2024 · 4 comments · Fixed by #2005
Closed
1 task done

Allow using native HTTP #1989

knaeckeKami opened this issue Jul 21, 2024 · 4 comments · Fixed by #2005
Labels
enhancement New feature or request

Comments

@knaeckeKami
Copy link
Contributor

knaeckeKami commented Jul 21, 2024

Please select which package this feature is related to

stream_chat

Which platforms would this feature impact?

iOS, Android, MacOS

Is your feature request related to a problem?

The HTTP Implementation in dart:io has many known issues.

stream_chat uses dio, with uses the http implementation from dart:io by default. It can be configured to use other implementations as well though, for example using https://pub.dev/packages/native_dio_adapter

But stream_chat does not expose the Dio client via exports, so it's not possible for users to change that.
Even when importing private APIs, it's difficult and error-prone to do so, as one would need to pass their own
StreamChatApi with a custom implementation of StreamHttpClient to the StreamChatClient.

Describe the solution that you'd like

I would like stream_chat to allow for a way to configure dio's httpClientAdapter.

A flexible way to do so would be to allow passing in a Dio Function() dioFactory, where users would be able to do something like

dioFactory: () {
   final dio = Dio();
   dioClient.httpClientAdapter = NativeAdapter();
   return dio;
}

Describe alternatives that you have considered

I would also be ok with defaulting to NativeAdapter, but this would introduce a new dependency to stream_chat and slightly increase bundle size for users who don't already depend on cupertino_http or cronet_http, so I can imagine that this is not a desired solution.

Additional context

It seems that it was an architectural decision to make using dio an implementation detail which is not exposed to the user, and this would break that.
I understand that, but given the limitations of the of the current approach I think that overall, this is still worth it.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@knaeckeKami knaeckeKami added the enhancement New feature or request label Jul 21, 2024
@kydav
Copy link

kydav commented Jul 29, 2024

I have also been seeing a lot of Bad File descriptor errors in the production implementation of my app that incorporates StreamChat. We monitor with Firebase Crashlytics, and have seen them since we implemented StreamChat in our app, but have just barely getting reports of it effecting users where they switch apps and the app crashes, and we have tied the multiple login attempt times to the crashlytics times. It would be good to get a resolution of some sort!

Looks like this was reported months ago and the issue was closed by a bot: #1899

Copy link

This issue is stale because it has been open for 20 days with no activity.

@github-actions github-actions bot added the Stale label Aug 19, 2024
@deven98 deven98 removed the Stale label Aug 20, 2024
@deven98
Copy link
Contributor

deven98 commented Aug 20, 2024

Hey @knaeckeKami,

Thanks for the issue. At the moment we are a bit busy with higher priority issues but we are in the process of expanding our Flutter team as we speak. I am adding this to our backlog - once we get some additional capacity, we will try to look into this possibility.

Thanks!

@knaeckeKami
Copy link
Contributor Author

knaeckeKami commented Aug 21, 2024

Thanks! Feel free to use my suggestion in #2005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants