-
Notifications
You must be signed in to change notification settings - Fork 877
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
IoT web socket connection continuously getting Connection Error #1057
Comments
sorry to hear that you are running into issues. To help debug this further, I have a few questions
|
@cbommas Thanks for the reply! Once the connection is dropped, I actually call a disconnect. The reason is that upon a disconnect event, I wanted to clear the access key and the session altogether. In the past (before the reconnection issues were fixed in some of your previous SDK releases), it was the only way for me to disable the auto retries and guarantee that we didn’t get into a reconnection loop (this was draining the battery on our app).
So with this in mind, upon connection dropped, we successfully disconnect, and then successfully establish a connection. But the issue is that then a connection error happens sometimes 10 seconds, 30 seconds, or 10 minutes later (completely variable), but definitely before the credentials expire. As per logic above, we then successfully disconnect, and establish a connection again. And the loop continues. My MQTT config is the following. However, with the above that I’ve stated, it won’t ever get put into effect. It would nice if you could add an option to disable auto retries altogether.
As far as turning on verbose logging and sending you logs, it is hard for me to reproduce. Thus, I’m not able to send you anything helpful at the moment, but I'll see if I can catch it again. |
Please let me know how it goes after you make these changes. |
@cbommas Yes, I am reconnecting with the same clientID. Could that be causing the issue? Do you know under what conditions it may cause it to happen? Oh, yeah, setting the baseReconnectTimeInterval to something much larger makes sense. So, if I set the baseReconnectTimeInterval to 900 (same as maxTimeInterval), and then get rid of the clear-out-the-key logic, would I still be able to manage my "manual" reconnect by dispatching another connect at 15 seconds or some time BEFORE the baseReconnectTimeInterval gets reached (and therefore keeping the same clientID)? Thanks! |
@mistyleaf
In your check above, I'd recommend looking for |
@mistyleaf So if it is at all possible, change the clientID each time you connect. If that doesn't work for you, then you should still be good when you set the baseReconnectTimeInterval to a larger number. |
One quick addition - you should also look for the |
@cbommas Thanks for the additional info on the connection states! That should be really helpful in fine-tuning the reconnection logic. Also, will try what you suggested and either change the clientID, or set the baseReconnectTimeInterval higher so I can still control retries but not have to clear out the key. One other question…is there any way to get more info on reasons for Connection Error? Trying to enable logging verbose didn’t seem to show much other info regarding this. Thanks! |
@mistyleaf Just curious - did my suggestions on this thread help address the re-connection issues that you were facing? Please let me know. |
It looks like you are good to go . I will go ahead and close this out - please feel free to reopen if you are still facing issues. |
In my case I was running two devices at the same time with the same clientID, so one was disconnecting the other in each reconnection. |
State your question
We are connecting to IOT using web socket. From time to time (not reproducible at will), we will see the following behavior.
We will successfully establish a connection. But then soon afterwards, we receive a MQTT Connection Error. We keep going in this loop. Sometimes the Connection Error could happen sometimes 5 seconds after connect, or 30 seconds later, or 10 minutes later.
A few questions:
Is there any light you can shed on why this might be happening? (Bad LTE connection? Keep-alive pings failing?)
What happens if keep-alive ping fails? Would this cause a Connection Error?
Is there a way to get better error messages on why Connection Error, or a better way to diagnose the issue?
Which AWS Services are you utilizing?
AWSIoT
Provide code snippets (if applicable)
Environment(please complete the following information):
Device Information (please complete the following information):
If you need help with understanding how to implement something in particular then we suggest that you first look into our developer guide. You can also simplify your process of creating an application, as well as the associated backend setup by using the Amplify CLI.
The text was updated successfully, but these errors were encountered: