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

missing PUBACK not recognized ?! #76

Closed
mfick76 opened this issue Jan 21, 2017 · 1 comment
Closed

missing PUBACK not recognized ?! #76

mfick76 opened this issue Jan 21, 2017 · 1 comment

Comments

@mfick76
Copy link

mfick76 commented Jan 21, 2017

Hi,
i have a simple MQTT Client which publishes messages to a MQTT Broker using QoS1.
If the broker did not send the PUBACK or it got lost then i would think the WaitTimout function used with the token from Client.publish should run in a timeout ?

I used following code:

 timer := time.NewTicker(1 * time.Second)
   for t := range timer.C {
      if initialized == 1 {
         token := cli.Publish(topic, 1, false, t.String())
         if( !token.WaitTimeout(5000) ) {
           if( token.Error() != nil ) {
              fmt.Println(token.Error())
           } else {
              mutex.Lock()
              sent = sent + 1
              mutex.Unlock()
           }
         } else {
            fmt.Println("timeout ACK");
         }
      }
   }

I have checked that the PUBACK from the Broker is missing by using a different Client written with the paho-mqtt3c library.

best regards
Markus

@alsm
Copy link
Contributor

alsm commented Dec 8, 2017

Hi, WaitTimeout returns false if it times out, I think the if statement you have should not have the ! in it.

@alsm alsm closed this as completed Feb 21, 2018
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