コード例 #1
0
        private string BuildMessage(string message, string topic)
        {
            var m = new MQTTMessage()
            {
                Message  = message,
                ClientId = this._clientId,
                Topic    = topic
            };

            return(m.ToJSON());
        }
コード例 #2
0
        bool client_PublishArrived(object sender, PublishArrivedArgs e)
        {
            var m = MQTTMessage.Parse(e.Payload.ToString(), e.Topic);

            if (m.ClientId == this._clientId)
            {
                // Ignore message sent by this instance
                return(false);
            }
            else
            {
                if (this.MessageArrived != null)
                {
                    this.MessageArrived(m);
                }
                return(true);
            }
        }