FactbirdHQ / mqttrust

MQTT client for embedded devices, written in rust
50 stars 5 forks source link

Propose Session trait and remove all the logic below the application-layer #20

Closed keisrk closed 2 years ago

keisrk commented 3 years ago

Although it looks pedantic I propose a session trait encapsulating network transaction in general. One downside of the TcpClient trait is that it only allows a single socket type. The Session trait is meant to be implemented by multiple transaction types and they can share the same driver type of TcpClient.

MQTT is defined on top of the applicaiton-layer and all that it requires is an active session. We can simplify the logic by assuming a user has performed connection to a broker in advance and supplies the session only.

It is nice and kind of the rumqtt client implementation where it takes care of all the TLS connection building, like CA and certs. However it is only possible because of tokio_tls and not the case for our embedded environment.

MathiasKoch commented 3 years ago

I will get to reviewing this and your other PRs, but at the moment i have gotten STRICT orders from Finn, not to add ANY new code, until we have fully verified that the connection state handling is as good as it needs to be. Thus i am pushing the reviews until they are applicable.

They do look sound at first sight though. :+1:

keisrk commented 3 years ago

Fully understood. For the time being we should focus on testing existing code base. Thanks for your comment :)

MathiasKoch commented 3 years ago

@keisrk Could you rebase this, so i can test it out?