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

connect timeout exception #223

Closed
PreethamRU opened this issue Sep 13, 2019 · 2 comments
Closed

connect timeout exception #223

PreethamRU opened this issue Sep 13, 2019 · 2 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@PreethamRU
Copy link

using this code to connect to thing, however, failed to connect. Can you help me with this. Code is below

from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient

myMQTTClient = AWSIoTMQTTClient("random")

myMQTTClient.configureEndpoint("somenumber.ap-south-1.amazonaws.com", 8883)

myMQTTClient.configureCredentials("C:\Users\preetham\Desktop\awsiot\root-CA.crt", "C:\Users\preetham\Desktop\awsiot\SWM-Preetham.private.key", "C:\Users\preetham\Desktop\awsiot\SWM-Preetham.cert.pem")

myMQTTClient.configureOfflinePublishQueueing(-1) # Infinite offline Publish queueing
myMQTTClient.configureDrainingFrequency(2) # Draining: 2 Hz
myMQTTClient.configureConnectDisconnectTimeout(10) # 10 sec
myMQTTClient.configureMQTTOperationTimeout(5) # 5 sec

myMQTTClient.connect()

while 1:
myMQTTClient.publish("topic", "myPayload", 1)

@KaibaLopez
Copy link
Contributor

Hi @PreethamRU , can you clarify a little, are you getting an error or are you timing out ? What is the code returning?

@KaibaLopez KaibaLopez added guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 16, 2019
@rolandma
Copy link

rolandma commented Oct 9, 2019

It's possible that you don't have the correct policy. For demonstration of the python SDK, the policy it automatically created is only allowing several actions, and I had been struggling with the connect timeout too, but then I changed the policy for the thing that I created for the test to the following:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:",
"Resource": "
"
}
]
}

That fixed my problem.

@graebm graebm added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants