mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 17:00:03 +08:00
Co-authored-by: chkr1011 <6939810+chkr1011@users.noreply.github.com>
22 lines
722 B
C#
22 lines
722 B
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// 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.Management.Automation;
|
|
|
|
namespace MQTTnet.PowerShell.Cmdlets;
|
|
|
|
[Cmdlet(VerbsLifecycle.Unregister, "MqttMessageHandler")]
|
|
public class UnregisterMqttMessageHandlerCmdlet : PSCmdlet
|
|
{
|
|
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
|
public required PsMqttSession Session { get; set; }
|
|
|
|
protected override void ProcessRecord()
|
|
{
|
|
// Clear all event handlers
|
|
Session.ClearMessageHandlers();
|
|
WriteObject($"All message handlers cleared for MQTT session.");
|
|
}
|
|
}
|