writeTo method

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

Writes the connect message payload to the supplied stream.

Implementation

@override
void writeTo(MqttByteBuffer payloadStream) {
  payloadStream.writeMqttStringM(clientIdentifier);
  if (variableHeader!.connectFlags.willFlag) {
    payloadStream.writeMqttStringM(willTopic!);
    payloadStream.writeMqttStringM(willMessage!);
  }
  if (variableHeader!.connectFlags.usernameFlag) {
    payloadStream.writeMqttStringM(username!);
  }
  if (variableHeader!.connectFlags.passwordFlag) {
    payloadStream.writeMqttStringM(password!);
  }
}