-
Notifications
You must be signed in to change notification settings - Fork 889
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
AppSync subscription connections are dropping with no feedback #1213
Comments
Hello @JLau-cy Sorry that you are having issues using the SDK. Could you please help answer these couple questions so that I can better investigate the issue?
Thanks, |
@rohandubal Please find answers below:
My workaround so far is to re-subscribe every time I land on a view controller that expects a subscription to ensure I have a live subscription. However this is not a scalable solution as there is a 2-3 seconds overhead to establish a new subscription and there are no connection state callbacks which means it is all guess work as to when a connection has been established or dropped. |
Thanks for the feedback @JLau-cy I will try to reproduce this issue on my side. |
Hello @JLau-cy I wrote a quick update to our sample using our Events starter sample which demonstrates how to do multiple long lived subs. You can apply the diff on the Github sample to check the changes. Please find the sample attached. |
@rohandubal Thank you. I am still having trouble at monitoring the MQTT connection status. Is it possible to add a Without the above, it is not possible to know for certain when a connection state changes. The scenario that I am trying to solve is:
The issue is if I perform 2 without knowing for certain subscription connection is active, there is a chance that I will miss a message sent to the topic. Some of the messages are unique and can only be sent once, hence missing these messages will cause issues in the app flow. |
Hi @JLau-cy We are exposing a watcher status as part of awslabs/aws-mobile-appsync-sdk-ios#42 This feature is specifically intended to allow you to solve the "query/mutate only after subscription is active" use case: once the status is updated to |
Hi @rohandubal , Even I'm also facing this issue. "Subscription Terminated" is displayed in logs.Its trying to re-establish connection but its not happening. Please fix this issue. |
Sorry for missing the update on this issue, but we believe this was fixed by iOS AppSync PR 196, and refined by @rohandubal on subsequent commits. If you see other issues, please open an issue in the iOS AppSync repo. |
Describe the bug
I am noticing that internally AppSync is dropping the web socket connection at random times with unknown reasons and are not reported back to the app. This is problematic as there is no callback for when this happens or when it connects for that matter.
As there is no feedback to web socket connection states from AppSync I cannot detect these connection drops. Other than relaunching the app or going in and out of a screen to trigger my code for subscription, there is no way to know when reestablish the connection based on these events.
Whenever a connection drops, I notice an error in the console (MQTT session error, code: 2). However there is no mention of the cause or ways to recover.
As these connection drops are happening randomly there is no defined way to reproduce. However I notice it the most when:
Sometimes between 3 and 4 or sometime after 4 I will notice MQTT session error, code: 2 in the console and if I navigate back to the first ViewController, I will no longer be receiving real time data.
If I do not navigate away from a view controller after establishing a connection I do not see a connection drop.
A thing to note is that I do not call cancel() anywhere in my code to terminate the subscription myself, so I am not sure what is causing the terminations.
In addition to this, every time it connects/ disconnects it take a considerable amount of time to do so (2-3 seconds). If during these times I make a Query or Mutation then it will most likely timeout, is this expected behaviour?
Which AWS service(s) are affected?
AWSAppSync iOS SDK
Expected behavior
I am expecting the ability to have a long lived object (singleton) to hold a number of AWSAppSyncSubscriptionWatcher objects such that no matter what ViewController I am on, my model objects can still be populated by real-time data.
I am also expecting ways to react to subscription lifecycle events (connected, disconnected, retry)
Environment(please complete the following information):
Device Information (please complete the following information):
The text was updated successfully, but these errors were encountered: