Expose server session items (#1638)

* Expose server session items

* Add support for custom session items for injected application messages
This commit is contained in:
Christian
2023-01-19 20:15:15 +01:00
committed by GitHub
parent b98417ab39
commit 2aa4219838
16 changed files with 185 additions and 149 deletions
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using MQTTnet.Packets;
@@ -9,23 +10,38 @@ namespace MQTTnet.Client
{
public sealed class MqttClientUnsubscribeResult
{
public IReadOnlyCollection<MqttClientUnsubscribeResultItem> Items { get; internal set; }
public MqttClientUnsubscribeResult(
ushort packetIdentifier,
IReadOnlyCollection<MqttClientUnsubscribeResultItem> items,
string reasonString,
IReadOnlyCollection<MqttUserProperty> userProperties)
{
PacketIdentifier = packetIdentifier;
Items = items ?? throw new ArgumentNullException(nameof(items));
ReasonString = reasonString;
UserProperties = userProperties ?? throw new ArgumentNullException(nameof(userProperties));
}
/// <summary>
/// Gets the user properties which were part of the UNSUBACK packet.
/// MQTTv5 only.
/// Gets the result for every topic filter item.
/// </summary>
public IReadOnlyCollection<MqttUserProperty> UserProperties { get; internal set; }
public IReadOnlyCollection<MqttClientUnsubscribeResultItem> Items { get; }
/// <summary>
/// Gets the reason string.
/// MQTTv5 only.
/// Gets the packet identifier which was used.
/// </summary>
public string ReasonString { get; internal set; }
public ushort PacketIdentifier { get; }
/// <summary>
/// Gets the packet identifier which was used.
/// Gets the reason string.
/// <remarks>MQTT 5.0.0+ feature.</remarks>
/// </summary>
public ushort PacketIdentifier { get; internal set; }
public string ReasonString { get; }
/// <summary>
/// Gets the user properties which were part of the UNSUBACK packet.
/// <remarks>MQTT 5.0.0+ feature.</remarks>
/// </summary>
public IReadOnlyCollection<MqttUserProperty> UserProperties { get; }
}
}
}