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

Logging capabilities in callbacks #41

Open
olafklinke opened this issue Jul 17, 2023 · 1 comment
Open

Logging capabilities in callbacks #41

olafklinke opened this issue Jul 17, 2023 · 1 comment

Comments

@olafklinke
Copy link

The return type of a SimpleCallback and OrderedCallback is IO (). These IO actions are subsumed in the IO MQTTClient return type of connectURI. However, the user might want to perform different action depeding on the content of a message, e.g. log messages upon receiving malformed messages.
It would be a major overhaul, but very useful, if net-mqtt provided a mechanism for structured error handling and reporting. For example, the MQTTClient type could expose a TChan that callbacks can write to and ambient applications can read from, so that worker threads and the ambient application can exchange messages in a structured way.

@dustin
Copy link
Owner

dustin commented Jul 18, 2023

This sounds like what the mqtt-watch callback does. For each inbound message, the message is sent to a tchan where it can be picked up by a thread that logs the message..

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