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

Default example for subscription using do is incorrect #15

Open
divbyzerofordummies opened this issue Jan 17, 2025 · 0 comments · May be fixed by #16
Open

Default example for subscription using do is incorrect #15

divbyzerofordummies opened this issue Jan 17, 2025 · 0 comments · May be fixed by #16

Comments

@divbyzerofordummies
Copy link

In the docs (README and docs of subscribe!), the do syntax is written with parantheses surrounding the arguments:

subscribe!(mqttconnection, "group1/device2", QOS.EXACTLY_ONCE) do (topic, payload)
    do_a_thing_for_device_two(payload)
end

This led to problems because Julia would complain about not finding a function with a signature expecting a tuple.
The function is actually called with two arguments, so the correct syntax would be

subscribe!(mqttconnection, "group1/device2", QOS.EXACTLY_ONCE) do topic, payload
    do_a_thing_for_device_two(payload)
end
@divbyzerofordummies divbyzerofordummies linked a pull request Jan 17, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant