Propagate errors triggered on 'waiting' #1014
Open
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.
Goals ⚽
When Starscream uses the
NWConnection
from the Network framework (iOS 12+), some scenarios just fail silently without any type of feedback or callback back to the caller.This is mainly due the fact that those errors are being returned when the connection state is
waiting
. According to Apple's documentationBut this state is being reached on 'fatal errors' like connection rejected because SSL pinning failed or timeouts. In those cases, as the
waiting
state is reached, Starscream just ignores the returned error and the client will just wait as it won't receive any callback.Implementation Details 🚧
To maintain compatibility with older implementations and to not modify existing behaviour a new
WebSocketEvent
has been addedwaiting(Error)
. This will contain the error propagated from theTCPTransport