Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 2.33 KB

advances_in_networking_part_1.md

File metadata and controls

78 lines (64 loc) · 2.33 KB

WWDC19

Table of Contents

=================

Advances in Networking, Part1 - Thursday

Session materials: https://developer.apple.com/videos/play/wwdc2019/712/

Low Data Mode

  • User preference to minimize data usage
    • Explicit signal to reduce network data use
    • Per wifi and cellular network
    • Background tasks are deferred in this mode
    • Background app refresh is also disabled

URLSession & Network.framework

  • Try large/prefetch with allowsConstrainedNetworkAccess = false

  • On failure with error.networkUnavailableReason == .constrained try low data mode alternative here

  • Set prohibitConstrainedPaths on NWParameters

  • Check isExpensive in NWPath

Combine in URLSession

.debounce()
.removeDuplicates
.filter {}
.map {}
.sink()
  • DataTaskPublisher
    • Single value publisher
    • Similar to URLSession.dataTask
    .tryCatch {}
    .tryMap {}
    .retry(1)
    .replaceError(with)
    .receive(on: Thread)
    .assign(to)
    

WebSocket

  • Two-way communication over TLS/TCP connection
  • Works with Firewalls and CDNs
  • Proxy support

URLSessionWebSocketTask

  • Compatible with URLSessionTask

  • Server-> NWListener

  • Client-> URLSessionWebSocketTask

  • Webkit -> Javascript Websocket

  • URLSession -> URLSessionWebSocketTask

    • Supports authentication and cookies
  • Network.framework -> Webseocket Connection & Listener

Mobility Improvements

Wi-Fi Assist in iOS 13

  • Cross-layer mobility detection is built into URLSession and Network.framework

  • Rethink SCNetworkReachability usage

  • Control access with allowsExpensiveNetworkAccess = false

Multipath Transports

  • Apple maps and music are now also using this technology as Siri to have a better transition between cellular & wi-fi