readFrom method

  1. @override
void readFrom(
  1. MqttByteBuffer payloadStream
)
override

Creates a payload from the specified header stream.

Implementation

@override
void readFrom(MqttByteBuffer payloadStream) {
  // The payload of the publish message is not a string, just
  // a binary chunk of bytes.
  // The length of the bytes is the length specified in the header,
  // minus any bytes spent in the variable header.
  final messageBytes = header!.messageSize - variableHeader!.length;
  message = payloadStream.read(messageBytes);
}