mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 02:53:06 +08:00
Implement enhanced PowerShell cmdlets with async handler, WebSocket, TLS, and more features
Co-authored-by: chkr1011 <6939810+chkr1011@users.noreply.github.com>
This commit is contained in:
co-authored by
chkr1011
parent
71140d12c7
commit
419d7622d8
@@ -38,6 +38,18 @@ public sealed class PsMqttSession : IDisposable
|
||||
|
||||
public event EventHandler<PsMqttMessage>? MessageReceived;
|
||||
|
||||
public void ClearMessageHandlers()
|
||||
{
|
||||
// Remove all event subscribers
|
||||
if (MessageReceived != null)
|
||||
{
|
||||
foreach (var handler in MessageReceived.GetInvocationList())
|
||||
{
|
||||
MessageReceived -= (EventHandler<PsMqttMessage>)handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_client.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user