Beispiel #1
0
        public MqttServer(IEnumerable <IMqttServerAdapter> adapters, IMqttNetChildLogger logger)
        {
            if (adapters == null)
            {
                throw new ArgumentNullException(nameof(adapters));
            }
            _adapters = adapters.ToList();

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            _logger = logger.CreateChildLogger(nameof(MqttServer));

            _eventDispatcher.ClientConnected            += (s, e) => ClientConnected?.Invoke(s, e);
            _eventDispatcher.ClientDisconnected         += (s, e) => ClientDisconnected?.Invoke(s, e);
            _eventDispatcher.ClientSubscribedTopic      += (s, e) => ClientSubscribedTopic?.Invoke(s, e);
            _eventDispatcher.ClientUnsubscribedTopic    += (s, e) => ClientUnsubscribedTopic?.Invoke(s, e);
            _eventDispatcher.ApplicationMessageReceived += (s, e) => ApplicationMessageReceived?.Invoke(s, e);
        }
 public void OnClientSubscribedTopic(string clientId, TopicFilter topicFilter)
 {
     ClientSubscribedTopic?.Invoke(this, new MqttClientSubscribedTopicEventArgs(clientId, topicFilter));
 }