AtherEnergy / rumqtt

Pure rust mqtt cilent
The Unlicense
202 stars 71 forks source link

Add retain flag to publish method #121

Closed TheBestJohn closed 5 years ago

TheBestJohn commented 5 years ago

implement a boolean parameter for #120.

Perhaps discussion should be made as to whether or not it would make sense to expose the publish struct in some way. You would be able to dynamically create one dependant on what you are looking for.

for example:

///Defaults to non retained, QOS 1 and publish should return error on malformed message
let mut message = MqttMessage::new();
message.payload("This is a payload")
                .topic("hello/world")
                .retain();

mqtt_client.publish(message);

I'm not sure about creating a dynamic impl inside a struct... can you do something like mqtt_client::message::new();? That would make things even easier in that you could call .publish() after the .retain()

TheBestJohn commented 5 years ago

Going to pull this back to merge request from a branch. Noob mistake