Beispiel #1
0
        private void ClientMqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
        {
            try
            {
                string message = Encoding.UTF8.GetString(e.Message);
                _logger.Log("Message recived " + e.Topic + " value " + message);

                string TopLevel = GMqtttopic.Replace("/#", "");
                string subtopic = e.Topic.Replace(TopLevel + "/", "");

                MessageReceived(subtopic, message);
            }
            catch (Exception ex)
            {
                _logger.Log("error: " + ex.Message);
            }
        }
Beispiel #2
0
 public string FullTopic(string topic)
 {
     return(GMqtttopic.Replace("#", topic));
 }