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

Disconnected by AWS IoT MQTT Broker #9

Open
dwarburt opened this issue Feb 7, 2018 · 1 comment
Open

Disconnected by AWS IoT MQTT Broker #9

dwarburt opened this issue Feb 7, 2018 · 1 comment

Comments

@dwarburt
Copy link

dwarburt commented Feb 7, 2018

Dropping the TLS example almost line-by-line into a test program for AWS IoT caused the server to close the connection when the first subscribe packet is sent.

When I put a time.Sleep(time.Second) in between the cli.Connect and cli.Subscribe calls, then it works just fine. It seems that AWS will close the connection if the subscribe comes too quickly. It seems like the key is to wait until that CONNACK packet is received before continuing with the other messages.

Can we add some sort of event or callback for CONNACK? Like a ConnectedHandler or maybe a buffered channel that sends connection lifecycle events that the main program can read?

@skx
Copy link

skx commented Apr 18, 2018

FWIW I see the same thing with a simple client that does three things:

  • Create a client, and connect.
  • Publish a message
  • Disconnect

If I disconnect "too quickly" the message is never received. I've had to add time.Sleep() calls into the middle of the steps which is horrid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants