Skip to content

AysyncHTTPClient support for linux#143

Open
JonasProgrammer wants to merge 4 commits intomattt:mattt/gate-linux-urlsessionfrom
SolbachLeads:bugfix/linux-url-session-2
Open

AysyncHTTPClient support for linux#143
JonasProgrammer wants to merge 4 commits intomattt:mattt/gate-linux-urlsessionfrom
SolbachLeads:bugfix/linux-url-session-2

Conversation

@JonasProgrammer
Copy link

As discussed in #127, the current workaround is not really feasible for async applications.

This PR includes an AsyncHTTPClient trait that does the following:

  • conditionally depend on AsyncHTTPClient
  • conditionally include the AsyncHTTPClient trait for EventSource
  • use typealiases to distinguish the session types

When untraited, the library should work as-is. Whith the trait active, the interface is changed to consume an HTTPClient as the session type.
I tried to change the business logic as little as possible, mostly implementing URLSession's extensions for HttpClient.

@KotlinFactory
Copy link
Contributor

Any updates on this perhaps?

@JonasProgrammer
Copy link
Author

Btw, as it stands now, the increased deadline fixes some of the timeouts, but not all of them. The existing HttpClient.shared instance, which is the default session with the enabled trait, has a read time out of only 90s and cannot be reconfigured.

Internally, we use modified timeouts along with another shared singleton session, but this is not ideal (AsyncHTTPClient does not expose the means of creating a proper singleton that cannot be shut down as they do with their own .shared singleton), thus not included in the PR.

If you have any suggestions regarding default timeouts etc., I'd be happy to improve the PR in that direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants