diff --git a/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java b/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java index c9379d7ffb..29eeb6cc29 100644 --- a/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java +++ b/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java @@ -323,7 +323,7 @@ public final class MqttEncoder extends MessageToMessageEncoder { buf.writeShort(topicNameBytes.length); buf.writeBytes(topicNameBytes); if (mqttFixedHeader.qosLevel().value() > 0) { - buf.writeShort(variableHeader.messageId()); + buf.writeShort(variableHeader.packetId()); } buf.writeBytes(payload);