Read payload as string
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user