parse-community / ParseLiveQuery-iOS-OSX

Parse LiveQuery Client for iOS/OS X.
https://parseplatform.org
Other
192 stars 133 forks source link

LiveQuery doesn't repsond to networking changes #248

Closed JoeSzymanski closed 3 years ago

JoeSzymanski commented 3 years ago

With the change to the newest version of Starscream, LiveQuery doesn't appear to have any logic to detect, handle, or pass to integrators information about network status changes.

At least on iOS 13+, this appears to result in the fact that, if the network status changes at all (temporary network drop, losing WiFi and switching to cellular, etc), LiveQuery will lose its connection entirely and be unable to recieve any messages.

I'm in the process of confirming if this issue also impacts iOS 12 or iOS 11 or less (since there are multiple engines that are used by Starscream now).

I'm not sure if the LiveQuery client should be handling these event types directly, or if they should be raising them up a layer to allow the applicatoin to handle the events.

JoeSzymanski commented 3 years ago

In some quick testing, this appears to be related to changes in Starscream, where the newer version of Starscream doesn't report a lost network connection as a disconnection event anymore, but rather uses the viability callback (at least in some cases).

JoeSzymanski commented 3 years ago

Another option here would be to force WebSocket to use the legacy engine implementation:

let socket = WebSocket(request: request, engine: WSEngine(transport: FoundationTransport(), certPinner: FoundationSecurity(), compressionHandler: nil))
JoeSzymanski commented 3 years ago

This is still blocking us from updating ParseLiveQuery, which also means we are blocked from updating Starscream. Is there anyone that might be able to look into this issue?

rostopira commented 3 years ago

Are there any workarounds available? Or is there are old version which is reliable?

JoeSzymanski commented 3 years ago

If you do not need functionality like proxy support, we have continued to use the previous versions of Parse Live Query (2.7.3) and Parse (1.19.0) without any major issues.