Read payload as string
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s

This commit is contained in:
2025-08-18 22:34:47 +02:00
parent 05c102aee8
commit de4e06401b

View File

@@ -1,3 +1,4 @@
using System.Text;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using MQTTnet; using MQTTnet;
@@ -21,8 +22,9 @@ public class MQTTClient : IHostedService
this.client.ApplicationMessageReceivedAsync += (e) => this.client.ApplicationMessageReceivedAsync += (e) =>
{ {
logger.LogInformation("Message received: {Message}", e.ApplicationMessage.Payload); string message = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
messageProcessor.ProcessMessage(e.ApplicationMessage.Payload.ToString()); logger.LogInformation("Message received: {Message}", message);
messageProcessor.ProcessMessage(message);
return Task.CompletedTask; return Task.CompletedTask;
}; };
} }