getWriteLength method
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;
}