Replace starscream with iOS 13+ URLSessionWebSocketTask #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The starscream library doesn't correctly report an initial connection failure to the SwiftStomp when using the default TCPTransport.swift transport library, and despite there being two pending PRs daltoniam/Starscream#904 and daltoniam/Starscream#821 which both attempt to address the issue neither has been merged for 3 and 4 years each respectively. Hopes of this being resolved any time soon are not high.
This makes use of SwiftStomp in a production environment where connectivity needs to be ensured with adequate retries etc impossible.
The alternative if running on iOS 13+ is to use the NativeTransport.swift library internally, but that's just a very thin wrapper for Apple's URLSessionWebSocketTask, making the use of Starscream itself fairly redundant.
I've therefore removed the dependency on Starscream and have implemented the underlying WebSocket transport natively using URLSessionWebSocketTask. Surprise 🎉!
This is a big PR but makes the library much more robust, simplifies some things and removes the dependency on Starscream which seems to have always been problematic at best.
Cases that have been tested: