Skip to content

Conversation

@mgoodfellow
Copy link
Contributor

It would be useful for .NET Core apps to be able to provide an instance of a HttpClient - this allows us to wire up the HttpClientFactory for better resource use.

Example in our application (SimpleInjector):

Container.Register<ISocketLabsClient>(
    () =>
    {
        var httpClientFactory = Container.GetInstance<IHttpClientFactory>();
        return new SocketLabsClient(socketLabsConfig.ServerId, socketLabsConfig.ApiKey, httpClientFactory.CreateClient());
    },
    Lifestyle.Scoped);

Feeback welcome

@mgoodfellow
Copy link
Contributor Author

Any chance of getting this merged?

@MattReibach
Copy link
Contributor

Hi Mike, thank you for your contribution. I am merging in your pull request and it will be included in our next package release. We will be updating our TargetFrameworks to include .NET 5.0 and hope to publish this release in the next few days. Thanks again for your contribution and your patience in waiting for the changes to be reviewed and merged.

@MattReibach MattReibach merged commit 20bd914 into socketlabs:main Nov 19, 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.

2 participants