From 3f3a12834838448458cc47a21b904eca80daf3d4 Mon Sep 17 00:00:00 2001 From: Peyton-McKee Date: Thu, 22 Feb 2024 23:24:07 -0500 Subject: [PATCH] Enforce Protobuf Measuring --- src/mqtt.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mqtt.rs b/src/mqtt.rs index 042e4b4..5f4ab31 100644 --- a/src/mqtt.rs +++ b/src/mqtt.rs @@ -36,7 +36,10 @@ impl Client for MqttClient { if let Some(client) = &self.client { let msg = mqtt::MessageBuilder::new() .topic(topic) - .payload(payload.write_to_bytes().unwrap()) + .payload( + protobuf::Message::write_to_bytes(&payload) + .unwrap_or("failed to serialize".as_bytes().to_vec()), + ) .finalize(); match client.publish(msg) {