Checklist No synchronous network calls happen on the main thread. Use a decent open-source networking library that does the threading for you. If the UI stutters or scrolling performance seems degraded, start looking for code that's blocking the main (UI) thread. 8 ▪ ▪ ▪
requests are too many? • Per-host limit on iOS and Android. Fuzzy documentation. • Generally you'll get limited to 4-5 depending on OS version, library or SDK (NSURLSession vs NSURLConnection). • Rule: just bundle requests and don't ﬂood hosts. 11
Best Practices Issue network requests in parallel (with limits). Have a single API request per screen. HTTP cache headers are your friend and API clients can use them intelligently. Pay attention to request size (and gzip compression). 12 ▪ ▪ ▪ ▪
faster than the speed of light 16 CC0 Problem: your datacenter is in Virginia and customers are in Singapore. Advanced: Consider implementing CDN caching of API requests as well. Content-delivery networks (CDNs) can move your static content physically closer to customers.
Practices Always test your app in airplane mode. Pay attention to user experience diﬀerences across diﬀerent regions, countries, and providers. Re-create bad networks locally using open-source tools (i.e. augmented-traﬃc-control, Network Link Conditioner) 17 ▪ ▪ ▪
for Mobile Best Practices Have clear, consistent documentation. Make mobile clients uniquely identiﬁable by the User-Agent HTTP header. Return standard error codes (200s, 400s, and 500s). Consider versioned APIs ("mobile is forever"). ▪ ▪ ▪ ▪