-
Notifications
You must be signed in to change notification settings - Fork 130
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
Subscription fails to reconnect when app is in background for a long time #396
Comments
I am facing the same issue. Do we know which version of sdk this would be fixed? Thank you |
Have you been able to find a work around for this? |
@chajuss and @sravichandran-gd @benrosen78 What authorization mode are you each using for your AppSync endpoint? |
@palpatim We are using AMAZON_COGNITO_USER_POOLS in our app. |
I'm using an API key. I added AppSync by running the |
We use API Key in our app |
Thanks for the updates. |
I believe I've identified the problem and am working on a fix. See aws-amplify/aws-appsync-realtime-client-ios#25 for a work in progress. No ETA on a release, but I'll be working on it tomorrow tomorrow. |
Thank you for your promptness. Much appreciated |
Thank you @palpatim |
Awesome work. Thank you! |
Do note that the release is in process just now, so please wait for 3.1.4 to become available on CocoaPods (which should be in an hour or so, depending on how long the CDN takes to sync up) |
Thats awesome. Thank you !! |
Released on 3.1.4. |
Thanks! Much appreciated! I have the app scheduled to re-subscribe every few minutes since the subscription may work for a period of time and it works perfectly after re-subscribing. Another way, a user will go off and on the screen to re-subscribe to renew the connection. The update is a great improvement, but I just wanted to highlight a few issues that may still remain for an enhancement if possible. Thanks again for all of your help! |
@howardevans21 Could you please open a new issue with details (including repro steps) of the issue you're still seeing? We haven't seen problems such as you describe, so there may be something else going on here. |
@palpatim I believe I got the issue resolved when I tested the iOS App. |
Describe the bug
I have an AWSAppSyncClient subscription to GraphQL via subscribe(subscription:queue:statusChangeHandler:resultHandler).
When going to background, I stop the subscription via AWSAppSyncSubscriptionWatcher.cancel(), and returning to foreground will try to create the subscription from scratch.
This works fine when the app is in background for short periods of time, however after being in the background for a longer period (~10-20 minutes and up), subscription fails to reconnect with "error The operation couldn’t be completed. (AppSyncRealTimeClient.ConnectionProviderError error 3.)"
To Reproduce
Start App and initialise a subscription to GraphQL via subscribe(subscription:queue:statusChangeHandler:resultHandler).
Make sure subscription is connected.
Send app to background and terminate subscription from applicationWillResignActive via AWSAppSyncSubscriptionWatcher.cancel().
Wait a rather long period of time (>10 minutes).
Activate app again and try to create a new subscription from applicationWillEnterForeground.
Subscription tries to reconnect over and over with the following errors:
2020-06-18 14:42:23.184613+0300 Veev[2875:3089365] [App Delegate] applicationWillEnterForeground(_:) 2020-06-18 14:42:23.186410+0300 Veev[2875:3090878] [AWS AppSync] monitorSubscription(status:): connecting 2020-06-18 14:42:23.251935+0300 Veev[2875:3090874] Connecting to url ... 2020-06-18 14:42:23.352693+0300 Veev[2875:3089690] [] nw_read_request_report [C2] Receive failed with error "Software caused connection abort" 2020-06-18 14:42:23.354298+0300 Veev[2875:3089690] [] nw_read_request_report [C4] Receive failed with error "Software caused connection abort" 2020-06-18 14:42:23.354898+0300 Veev[2875:3089690] [] nw_read_request_report [C3] Receive failed with error "Software caused connection abort" 2020-06-18 14:42:23.832433+0300 Veev[2875:3090881] [Services] onUpdate(): status is Available 2020-06-18 14:42:24.643831+0300 Veev[2875:3089690] WebsocketDidConnect 2020-06-18 14:42:24.644169+0300 Veev[2875:3089690] WebsocketDidConnect, sending init message... 2020-06-18 14:42:24.644804+0300 Veev[2875:3089690] Validating connection 2020-06-18 14:42:24.646696+0300 Veev[2875:3090881] Realtime connection is stale, disconnected. 2020-06-18 14:42:24.660200+0300 Veev[2875:3090881] The operation couldn’t be completed. (AppSyncRealTimeClient.ConnectionProviderError error 3.) 2020-06-18 14:42:24.661796+0300 Veev[2875:3090881] Retrying subscription 8A84E75F-CC65-4E91-9E93-061775CAF56C after milliseconds(217) 2020-06-18 14:42:24.675583+0300 Veev[2875:3090874] Message type does not need signing - connectionInit("connection_init") 2020-06-18 14:42:24.675858+0300 Veev[2875:3090874] Websocket write - {"type":"connection_init"} 2020-06-18 14:42:24.920531+0300 Veev[2875:3090874] Connecting to url ... 2020-06-18 14:42:26.178636+0300 Veev[2875:3090878] WebsocketDidConnect 2020-06-18 14:42:26.178740+0300 Veev[2875:3090878] WebsocketDidConnect, sending init message... 2020-06-18 14:42:26.178851+0300 Veev[2875:3090878] Validating connection 2020-06-18 14:42:26.179641+0300 Veev[2875:3090878] Realtime connection is stale, disconnected. 2020-06-18 14:42:26.180087+0300 Veev[2875:3090878] The operation couldn’t be completed. (AppSyncRealTimeClient.ConnectionProviderError error 3.) 2020-06-18 14:42:26.180223+0300 Veev[2875:3090878] Retrying subscription 8A84E75F-CC65-4E91-9E93-061775CAF56C after milliseconds(481)
Expected behavior
Subscription should reconnect without error.
Environment:
Device Information:
Additional context
Trying to restart the subscription after error is received fails with the same behaviour.
The text was updated successfully, but these errors were encountered: