mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 11:03:07 +08:00
Add more function mappings for MQTTnet Server.
This commit is contained in:
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using MQTTnet.Client.Options;
|
||||
using MQTTnet.Client.Receiving;
|
||||
using MQTTnet.Extensions.ManagedClient;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
@@ -34,10 +35,10 @@ namespace MQTTnet.TestApp.NetCore
|
||||
try
|
||||
{
|
||||
var managedClient = new MqttFactory().CreateManagedMqttClient();
|
||||
managedClient.ApplicationMessageReceived += (s, e) =>
|
||||
managedClient.ApplicationMessageReceivedHandler = new MqttApplicationMessageHandlerDelegate(e =>
|
||||
{
|
||||
Console.WriteLine(">> RECEIVED: " + e.ApplicationMessage.Topic);
|
||||
};
|
||||
});
|
||||
|
||||
await managedClient.PublishAsync(builder => builder.WithTopic("Step").WithPayload("1"));
|
||||
await managedClient.PublishAsync(builder => builder.WithTopic("Step").WithPayload("2").WithAtLeastOnceQoS());
|
||||
|
||||
Reference in New Issue
Block a user