Skip to content

Conversation

@rose-a
Copy link
Collaborator

@rose-a rose-a commented Mar 28, 2019

Hi, I went on and exposed the HttpClient from inside the GraphQLClient and also made the constructor accepting a HttpClient public (its "exposed" by the HttpClientExtensions anyway).

This makes it easier to use the library in combination with DI systems.

Exposing the HttpClient as a readonly property has the advantage that existing extension methods from other libraries (like from the IdentityModel library) can be used with GraphQLHttpClient as well.

…iving a HttpClient public to make id usable by DI containers
@PeterTognola
Copy link

Hi, this would also be great to have. Is there any plan on completing this pull request?

@raphaabreu
Copy link

Hello @deinok, how can I help you to get this PR approved and available on a nuget package? I am using this client in a scenario with 10k requests/s and the fact that I cannot reuse an HttpClient from the IHttpClientFactory is totally killing my performance. For now I have no choice but to send the http request myself but I would really want to do this through the GraphQL Client.

Just give me the directions and I'll make the time to get it done.

@wc-matteo
Copy link

I also need this. Can we make it happen? @deinok

@raphaabreu
Copy link

I ended up forking and making available a version that is a simple wrapper around an HttpClient. We had several issues when we started to load test the usage of this client because of the way the original package created the http message handler inside the options object, with no way of reusing or properly disposing it, causing socket exhaustion.

The wrapper version I made is exactly the same except for the fact that you have to provide a fully configured httpclient to it.

https://www.nuget.org/packages/GraphQL.HttpClientWrapper/

@wc-matteo
Copy link

Sounds awesome, thanks @raphaabreu !

@benmccallum
Copy link

We're getting socket exhaustion too, and this might be the culprit. Thanks so much for writing this and releasing via NuGet. Hopefully this project, under the graphql-dotnet banner, gets fixed; as that's really not the way to handle HttpClient, for x-compat (not just targeting corefx) it should really be requiring a HttpClient be passed in so the consumer can manage its lifetime and in corefx we can register it as a typed client.

@rose-a
Copy link
Collaborator Author

rose-a commented Feb 5, 2020

incorporated in #152

@rose-a rose-a closed this Feb 5, 2020
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.

5 participants