Hi! I am trying to publish a retained MQTT message to my Mosquitto backend, but it does not get retained when I use ClientProxy directly:
const record = new MqttRecordBuilder({ hello: "world"})
.setRetain(true)
.build();
this.clientProxy.send("test", record);
The message gets published alright, but the retention flag is not set. I tried with .emit() instead of .send() as well, with no more success.
However, if I create an MqttClient by injecting ClientMqtt specifically to my service, and calling ClientMqtt.createClient(), this works as expected, and the message is retained on the server just fine:
mqttClient.publish("test", JSON.stringify({ hello: "world" }), { retain: true });
Is this a bug, or am I missing something? Thanks!