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 Norman Maurer
parent 10dfd36030
commit 82e5ca7e7f

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);