Преглед на файлове

Update Wiki samples.

release/3.x.x
Christian Kratky преди 5 години
родител
ревизия
a2414f48ca
променени са 1 файла, в които са добавени 16 реда и са изтрити 0 реда
  1. +16
    -0
      Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs

+ 16
- 0
Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs Целия файл

@@ -733,6 +733,22 @@ namespace MQTTnet.TestApp.UniversalWindows
var mqttServer = new MqttFactory().CreateMqttServer();
}

{
// Setup application message interceptor.
var options = new MqttServerOptionsBuilder()
.WithApplicationMessageInterceptor(context =>
{
if (context.ApplicationMessage.Topic == "my/custom/topic")
{
context.ApplicationMessage.Payload = Encoding.UTF8.GetBytes("The server injected payload.");
}

// It is also possible to read the payload and extend it. For example by adding a timestamp in a JSON document.
// This is useful when the IoT device has no own clock and the creation time of the message might be important.
})
.Build();
}

{
// Setup subscription interceptor.
var options = new MqttServerOptionsBuilder()


Зареждане…
Отказ
Запис