Example #1
0
        /// <summary>
        ///     Writes the connect message payload to the supplied stream.
        /// </summary>
        /// <param name="payloadStream"></param>
        /// <remarks>
        ///     A basic message has no Variable Header.
        /// </remarks>
        public override void WriteTo(Stream payloadStream) {
            payloadStream.WriteMqttString(ClientIdentifier);
            if (variableHeader.ConnectFlags.WillFlag) {
                payloadStream.WriteMqttString(WillTopic);
                payloadStream.WriteMqttString(WillMessage);
            }

            if (variableHeader.ConnectFlags.UsernameFlag)
            {
                payloadStream.WriteMqttString(Username);
            }

            if (variableHeader.ConnectFlags.PasswordFlag)
            {
                payloadStream.WriteMqttString(Password);
            }
        }
Example #2
0
 protected void WriteTopicName(Stream stream) {
     stream.WriteMqttString(TopicName.ToString());
 }
Example #3
0
 protected void WriteProtocolName(Stream stream) {
     stream.WriteMqttString(ProtocolName);
 }
Example #4
0
 /// <summary>
 ///     Writes the payload to the supplied stream.
 /// </summary>
 /// <param name="payloadStream"></param>
 /// <remarks>
 ///     A basic message has no Variable Header.
 /// </remarks>
 public override void WriteTo(Stream payloadStream) {
     foreach (var subscription in Subscriptions) {
         payloadStream.WriteMqttString(subscription.Key);
         payloadStream.WriteByte((byte) subscription.Value);
     }
 }
Example #5
0
 /// <summary>
 ///     Writes the payload to the supplied stream.
 /// </summary>
 /// <param name="payloadStream"></param>
 public override void WriteTo(Stream payloadStream) {
     foreach (var topic in subscriptions) {
         payloadStream.WriteMqttString(topic);
     }
 }