Skip to content

Monitoring offline not working #403

@thomas-cassany

Description

@thomas-cassany

Describe the bug
When the SDK lost the network connection, the observers registered with observeCurrentConnectionMode are not called.

client.connectionInformation has currentConnectionMode set to streaming. when the network connection is lost or any SynchronizingError except unauthorized one happens, the SDK detects the issue, update LDClient.connectionInformation.lastConnectionFailureReason, but never informs the observers registered with observeCurrentConnectionMode

It's due to ConnectionInformation.synchronizingErrorCheck that updates connectionInformation but doesn't change currentConnectionMode. The switch of currentConnectionMode is needed to trigger the call to the observers. For some SynchronizingError (maybe all), currentConnectionMode should be set to offline until the connection is back. Or it can be set to establishingStreamingConnection, if the error is temporary.

To reproduce

  • Start and wait the client connectionInformation to have currentConnectionMode == streaming
  • Stop the network of your device
  • observeCurrentConnectionMode not called

Expected behavior
Observer of observeCurrentConnectionMode called with the mode offline or establishingStreamingConnection

Logs

Library version
Reproduced with the version 9.8.2.

XCode and Swift version
XCode 15.4 Swift 5

Platform the issue occurs on
Found on iPhone but likely to be all other platform too( iPad, macOS, tvOS, or watchOS)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions