-
Notifications
You must be signed in to change notification settings - Fork 5
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
Passing client to on_message? #21
Comments
Hey! I think it's a good addition. It would also turn The only downside is the fact that it introduces a breaking change, but I do think it's (1) worth it and (2) unavoidable if we want to follow the design described above. Your contribution for this would be very welcome! :) Footnotes
|
The implementation should be fairly straightforward, but, if you decide to implement it, don't hesitate to ask for help or pointers. |
I'm pretty sure I'm going to approach it in my spare time. There's one problem though: when going down the path of storing the The reason for it seems to be the following. When messages are processed the ordinary way every ocaml-mqtt/lib/mqtt_client/Mqtt_client.ml Line 90 in ee6f43c
However, when I ocaml-mqtt/lib/mqtt_client/Mqtt_client.ml Line 306 in ee6f43c
I got myself around this by scheduling publishing for later by mean of All in all, it seems that exposing Regretfully this still makes What are your thoughts? P.S. Sorry for a long-read! |
Hey, thanks for the wonderful work of picking up the abandoned repository! I'm really enjoying coding one of my hobby projects with OCaml.
So here's the thought:
Current API forces you to provide the
on_message
handler during connection, and this indeed seems to be a reasonable way to do it. However, I find myself in a situation where I need to useclient
in theon_message
handler e.g. to reply back.What do you think of adding an argument named
client
to theon_message
handler function? This way one won't have to resort to storingclient
somewhere in the global state.If you agree with the concept I might take a stab at implementing it.
The text was updated successfully, but these errors were encountered: