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

Docs for SetKeepAlive on connection options are incorrect #152

Closed
natefinch opened this issue Nov 15, 2017 · 1 comment
Closed

Docs for SetKeepAlive on connection options are incorrect #152

natefinch opened this issue Nov 15, 2017 · 1 comment

Comments

@natefinch
Copy link

natefinch commented Nov 15, 2017

https://godoc.org/github.com/eclipse/paho.mqtt.golang#ClientOptions.SetKeepAlive

The docs say "SetKeepAlive will set the amount of time (in seconds)"

I was looking at my callsite, which was

options.SetKeepAlive(60)

Looking at the comment, you'd think this would set the keep alive to 60 seconds. But it does not. It sets the keepalive to 60 nanoseconds.... (which gets rounded down to 0, so no keepalive). That's kind of a big difference.

Remove "(in seconds)" from the doc string, or clarify that it will be rounded down to the nearest second... but don't say it's in seconds, because it's not. It's a time.Duration, which is fine, but very different.

@alsm
Copy link
Contributor

alsm commented Nov 16, 2017

Sorry about that, must have been from when they were strictly seconds, SetPingTimeout was also wrong.

alsm added a commit to alsm/paho.mqtt.golang that referenced this issue Nov 16, 2017
At some point in the past these functions probably did take ints and assumed those
values would relate to the number of seconds for these features. They were changed
to take a time.Duration but the docs were not updated.

resolves eclipse-paho#152
@alsm alsm closed this as completed Nov 16, 2017
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