The Client's readAndObserve/readOneAndObserve methods currently just provide the current data that was subscribed to, but don't take into account the following aspects:
- Network errors are not handled decently and uniformly:
- No callbacks are registered to listen to network errors that can occur after the subscription was made, and, hence, there's no way to know that the subscription is having problems.
- In case of a network's failure during the initial data reading, an exception is thrown from the respective
readAndObserve method. Since this is not just a one-time reading (data fetching) functionality but a live data observation functionality, where an error can occur at any point in time, it is appropriate to ensure uniform error handling regardless of when the error has occurred.
- There's currently no way to cancel the subscription made by
readAndObserve if/when needed explicitly.
The
Client'sreadAndObserve/readOneAndObservemethods currently just provide the current data that was subscribed to, but don't take into account the following aspects:readAndObservemethod. Since this is not just a one-time reading (data fetching) functionality but a live data observation functionality, where an error can occur at any point in time, it is appropriate to ensure uniform error handling regardless of when the error has occurred.readAndObserveif/when needed explicitly.