smartrent / jackalope

An opinionated MQTT client library based on Tortoise MQTT
Apache License 2.0
28 stars 5 forks source link

Restructure callback structure #13

Closed gausby closed 3 years ago

gausby commented 3 years ago

Restructuring the exposed callback hooks; the original design had the TortoiseClient call into callbacks defined on Hare, via an app_handler behaviour. I have restructured this a bit, for instance the callbacks concerning messages received from server, progressing inflight messages, will always have to go to Hare—as it need it for bookkeeping.

The processes that need to talk to Hare now knows about its pid (and it is supervised such that the pid should always be correct), and most of the updates are now passed as a message pass to Hare. Some of the handle_casts are therefore handle_info's now. The only callbacks we need to expose to the end user would be handle_message.