5.9.0 Released!

Released on 2024-03-03. All issues associated with this milestone can be found using this filter.

Added

  • [:fire: Experimental :fire:] WebSocketRequest, as a wrapper for URLSessionWebSocketTask. This preview release is undocumented behind @_spi(WebSocket). Its API will change in the future, especially to adopt typed throws, but it is largely feature complete, tested, and usable now. API feedback, missing use cases, and bug reports are much appreciated before it goes fully public.
  • PrivacyInfo.xcprivacy file and integration with SPM, CocoaPods, and Carthage.
  • AlamofireDynamic target, to force dynamic linking in Xcode when using SPM. Only use when you know you need it.
  • AFInfo enum and a public version value to get Alamofire's current version, AFInfo.version.

Updated

  • Alamofire to require Swift 5.7.1.
  • Project structure to break apart large Request.swift file and consolidate various Request subclasses into their own files.
  • Empty type to be Sendable.
  • .swiftformat to remove duplicate rules.

Fixed

  • Platform deprecation warnings in Package.swift in newer Xcode versions.
  • Alamofire.podspec after project restructuring.
  • Various documentation typos.

WebSocketRequest took so long because I started development while a nasty bug was present on Apple's OSes. I posted this in the original PR to detail the bug:

This feature was delayed so long due to the many hours of frustration I had to deal with when Apple shipped a message dropping bug in iOS 14.5 - 14.7. In trying to test the socket connections I would connect to the test server, have it reply with a message, and then close the connection. Shockingly that meant that sometimes the messages wouldn't come through. But sometimes they would. Investigating other web socket clients and inspecting network traffic with Wireshark revealed that the messages were being sent by the server but the client just wasn't receiving them. Further investigation showed that delaying the close of the connection by 60ms or so let the client receive the message reliably. After many hours I finally had reliable tests! Only to then test on the iOS 15 betas and see that I didn't need the delay at all, the tests were reliable without it! Turns out it was just a bug in iOS 14.5 - 14.7. I was so disgusted by this fact that I gave up on the feature for years. I'll call out this bug in the documentation.