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 MQTTnet;
@@ -21,8 +22,9 @@ public class MQTTClient : IHostedService
this.client.ApplicationMessageReceivedAsync += (e) =>
{
logger.LogInformation("Message received: {Message}", e.ApplicationMessage.Payload);
messageProcessor.ProcessMessage(e.ApplicationMessage.Payload.ToString());
string message = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
logger.LogInformation("Message received: {Message}", message);
messageProcessor.ProcessMessage(message);
return Task.CompletedTask;
};
}