awslabs / awslabs/aws-mobile-appsync-sdk-android

Subscription retry even when the first request is unsuccessful

Open
#94 1 comment 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
Java
Stars
106
Forks
56
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
The subscription reconnect feature introduced in 2.7.0 works fine when the SDK first succeeds to subscribe and then the internet connectivity is lost. However, this feature does not work when the first subscription request is unsuccessful. I want the SDK to retry subscription even in this case.

This issue is reproducible in [AWS Mobile App Sync Starter App for Android](https://github.com/aws-samples/aws-mobile-appsync-events-starter-android) with AppSync SDK version 2.7.0, 2.7.1, 2.7.2 and 2.7.3 by following steps:
1. Open the starter app (ListEventActivity)
2. Turn on the airplane mode on the device
3. Tap an event to open ViewEventActivity (The activity tries to make a subscription but fails because of no internet connection)
4. Turn off the airplane mode (No subscription retry will be performed)

**Describe the solution you'd like**
I want the subscription reconnect logic to work even when the first request is unsuccessful.

**Describe alternatives you've considered**
When the first request is unsuccessful, `onFailure()` method of `AppSyncSubscriptionCall.Callback` is called, so re-creating a subscription when it is the first request may work. However, there seems to be no way to find if the subscription request is performed for the first time or not.

Contributor guide

Open the contributing guide

Research direction

Reproduce the sequence in ListEventActivity and ViewEventActivity with airplane mode enabled, then inspect the subscription handling around AppSyncSubscriptionCall.Callback.onFailure(). Trace how reconnect works after a successful subscription and determine what state distinguishes an initial failed request. Done means the subscription retries after connectivity returns, with regression coverage for the initial failure path.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, graphql, java
Domain
api, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.