Now I can publish message using this
MqttServerClient client = MqttServerClient.withPort(broker, "", 1883); //connect broker
//create message
final builder = MqttClientPayloadBuilder();
builder.addString(message);
client.publishMessage(topic, MqttQos.atLeastOnce, builder.payload); //publish message
but how can I set published message to Retain.
As per the docs the syntax is:
So your
publish
would need to be: