Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SubscriptionStatusObserver block to subscribe calls in AWSAppSyncClient #75

Closed
wants to merge 1 commit into from
Closed

Added SubscriptionStatusObserver block to subscribe calls in AWSAppSyncClient #75

wants to merge 1 commit into from

Conversation

MarioBajr
Copy link
Contributor

@MarioBajr MarioBajr commented Sep 22, 2018

The current AppSyncClient subscription API provides only callbacks to receive real time updates, but not enough to provide a better experience. The only callback that can be registered is the resultHandler, which provides feedback from failure or the real time message package, not exposing basic connection status like if I managed to subscribe and just sits in the connected state waiting for updates, or if I'm still connecting, not being ready to receive real time updates.

The goal of this PR is to expose the status of subscriptions, enabling clients to know when the system is ready to receive real time updates. Not only exposing all steps while establishing a connection but also all different types of errors.

Description of changes:

  • Created a new optional block in the subscribe method, requesting the closure SubscriptionStatusObserver that will provide updates, and the property status to the MQTTSubscriptionWatcher protocol.
  • Deprecated the unnecessary getIdentifier(), relying on the behaviour that MQTTSubscriptionWatcher is locked to be reference typed.
  • Replaced generic struct based AWSAppSyncSubscriptionError by a more descriptive enum based.
  • Updates MQTTClient tests

Considerations:

This code deprecates:

  • MQTTSubscriptionWatcher.getIdentifier
  • AWSAppSyncSubscriptionWatcher.uniqueIdentifier
  • AWSAppSyncSubscriptionError.additionalInfo
  • AWSAppSyncSubscriptionError.errorDetails

This code removes:

  • class SubscriptionsOrderHelper

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…yncClient, exposing all socket status.

- Updated MQTTSubscriptionWatcher with new status property and delegate, deprecated unnecessary getIdentifier(), relying on the behaviour that MQTTSubscriptionWatcher is locked to be reference typed.
- Replaced generic struct based AWSAppSyncSubscriptionError by a more descriptive enum based.
- Updates MQTTClient tests
@rohandubal
Copy link
Contributor

Hello @MarioBajr

Thanks for this PR and sorry I have not been able to get to it. Exposing these many states might make it a bit complicated for everyone to use. We need to refine how we want to make this functionality available. I am closing this PR in favor of coming up with a spec discussion/ feature request on how to support this in #42

Thanks,
Rohan

@rohandubal rohandubal closed this Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Community contribution PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants