getWriteLength method

  1. @override
int getWriteLength ()
override

Gets the length of the write data when WriteTo will be called.

Implementation

@override
int getWriteLength() {
  var headerLength = 0;
  final enc = MqttEncoding();
  headerLength += enc.getByteCount(protocolName);
  headerLength += 1; // protocolVersion
  headerLength += MqttConnectFlags.getWriteLength();
  headerLength += 2; // keepAlive
  return headerLength;
}