Replace MQTT deprecated API usage

Motivation:

Mqtt procotol defines packetId instead of messageId, replace deprecated method to match protocol definition

Modification:

Replace messageId() to packetId() in MqttEncoder

Result:

Match mqtt protocol definition and improve readability.
This commit is contained in:
luffyke 2020-03-31 03:23:23 +08:00 committed by GitHub
parent 84ebf47515
commit 7e823e3842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -323,7 +323,7 @@ public final class MqttEncoder extends MessageToMessageEncoder<MqttMessage> {
buf.writeShort(topicNameBytes.length);
buf.writeBytes(topicNameBytes);
if (mqttFixedHeader.qosLevel().value() > 0) {
buf.writeShort(variableHeader.messageId());
buf.writeShort(variableHeader.packetId());
}
buf.writeBytes(payload);