mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 10:26:11 +08:00
43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace MQTTnet.Server
|
|
{
|
|
public class MqttServerEventDispatcher
|
|
{
|
|
public event EventHandler<MqttClientSubscribedTopicEventArgs> ClientSubscribedTopic;
|
|
|
|
public event EventHandler<MqttClientUnsubscribedTopicEventArgs> ClientUnsubscribedTopic;
|
|
|
|
public event EventHandler<MqttClientConnectedEventArgs> ClientConnected;
|
|
|
|
public event EventHandler<MqttClientDisconnectedEventArgs> ClientDisconnected;
|
|
|
|
public event EventHandler<MqttApplicationMessageReceivedEventArgs> ApplicationMessageReceived;
|
|
|
|
public void OnClientSubscribedTopic(string clientId, TopicFilter topicFilter)
|
|
{
|
|
ClientSubscribedTopic?.Invoke(this, new MqttClientSubscribedTopicEventArgs(clientId, topicFilter));
|
|
}
|
|
|
|
public void OnClientUnsubscribedTopic(string clientId, string topicFilter)
|
|
{
|
|
ClientUnsubscribedTopic?.Invoke(this, new MqttClientUnsubscribedTopicEventArgs(clientId, topicFilter));
|
|
}
|
|
|
|
public void OnClientDisconnected(string clientId, MqttClientDisconnectType disconnectType)
|
|
{
|
|
ClientDisconnected?.Invoke(this, new MqttClientDisconnectedEventArgs(clientId, disconnectType));
|
|
}
|
|
|
|
public void OnApplicationMessageReceived(string senderClientId, MqttApplicationMessage applicationMessage)
|
|
{
|
|
ApplicationMessageReceived?.Invoke(this, new MqttApplicationMessageReceivedEventArgs(senderClientId, applicationMessage));
|
|
}
|
|
|
|
public void OnClientConnected(string clientId)
|
|
{
|
|
ClientConnected?.Invoke(this, new MqttClientConnectedEventArgs(clientId));
|
|
}
|
|
}
|
|
}
|