Resuse of ServiceClients?

I am looking at trying out the new JsonHttpClient and I found this link which says that an HttpClient should be instantiated once and reused. Does this apply for ServiceStack in this case for iOS and Android? How would this affect the Request and Response filters?

In the same breath, what is recommended practice for the older JsonServiceClient with regards to reuse?

The JsonHttpClient encapsulates and uses a single HttpClient for all its requests (accessible at JsonHttpClient.HttpClient), so the lifetime is the same as the recommended lifetime for normal HttpClient.

The JsonServiceClient creates a new HttpWebRequest each time which ultimately doesn’t matter since they’re pooled behind-the-scenes, so you can use a single or multiple instances.

Perfect that’s what I suspected. Thanks for clarifying!

I’m seeing huge perf benefits from using the JsonHttpClient with ModernHttpClient on iOS!

That’s great to hear :smile: