Adds private method betterPath(isAvailable:) for migrating the internal NWConnection when a better network path becomes available (e.g. The device is using a cellular connection and a Wi-Fi connection becomes available, or a Wi-Fi connection drops but there is a cellular connection available).
Adds webSocketDidAttemptBetterPathMigration(result:) for informing the delegate.
Adds private method viabilityDidChange(isViable:) for reporting connection viability changes (e.g. the Wi-Fi connection drops out).
Adds webSocketViabilityDidChange(connection:isViable:) for informing the delegate.
Consolidates error reporting into reportErrorOrDisconnection(_ error:) method
Improves detection of unexpected disconnection events, and informs the delegate accordingly.
This PR:
betterPath(isAvailable:)
for migrating the internalNWConnection
when a better network path becomes available (e.g. The device is using a cellular connection and a Wi-Fi connection becomes available, or a Wi-Fi connection drops but there is a cellular connection available).webSocketDidAttemptBetterPathMigration(result:)
for informing the delegate.viabilityDidChange(isViable:)
for reporting connection viability changes (e.g. the Wi-Fi connection drops out).webSocketViabilityDidChange(connection:isViable:)
for informing the delegate.reportErrorOrDisconnection(_ error:)
method