Leveraging native REST libraries and making efficient network calls
In a connected world, while your application grows, you will see that calls to web services are getting stressed and often, and all these calls will be asynchronous concurrent network requests.
Issuing a lot of requests will end up making your app slow, and managing these requests by hand, such as who has priority and when, or how many calls at a time are allowed, will break a lot of encapsulation between different components, resulting in spaghetti code.
It's ok! We can fix this. There are two libraries out there, created by Paul Betts, to save the day: modernhttpclient
and Punchclock
. Let's see how to install and use them in our network calls.
How to do it…
- In Visual Studio, create ...
Get Xamarin: Cross-Platform Mobile Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.