You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
482 B

  1. using MQTTnet.Protocol;
  2. namespace MQTTnet.Formatter
  3. {
  4. public static class MqttPacketWriterExtensions
  5. {
  6. public static byte[] AddMqttHeader(this IMqttPacketWriter writer, MqttControlPacketType header, byte[] body)
  7. {
  8. writer.Write(MqttPacketWriter.BuildFixedHeader(header));
  9. writer.WriteVariableLengthInteger((uint)body.Length);
  10. writer.Write(body, 0, body.Length);
  11. return writer.GetBuffer();
  12. }
  13. }
  14. }