Hi, does the String.Extensions use a Client Connection Pool? Thinking from a Resource perspective in a Xamarin App, should one use one Client vs using StringExt to initiate REST calls?
Do you mean HttpUtils? https://github.com/ServiceStack/ServiceStack/wiki/Http-Utils
It uses HttpWebRequest which already enabled connection pooling by default.
It’s unlikely you need to change the defaults but the pooling behavior can be configured with: ServicePoint / ServicePointManager classes:
https://msdn.microsoft.com/en-us/library/system.net.servicepoint.aspx
https://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.aspx
Daniel Halan:
was thinking about JsonServiceClient, what (if any) resource gains is it to only create one “JsonServiceClient” vs using “http://…”.GetJsonFromUrl() for multiple calls… this in Context of a Mobile app, where resource efficiency is still a high priority.
They both create new instances of HttpWebRequest, but that doesn’t really matter as all connections are managed/pooled by the underlying connection manager. So it’s unlikely it’ll have any difference - but if in doubt, measure.
Daniel Halan:
Ok, so assuming that JsonServiceClient is a very lightweight object, nothing worth reusing?
I still re-use the JsonServiceClient out of convenience, as you’ll also need to do this for authenticated requests where the session cookies are populated on the client. But either way, each new request with the JsonServiceClient uses a new HttpWebRequest.