diff --git a/apps/emqtt/src/emqtt_protocol.erl b/apps/emqtt/src/emqtt_protocol.erl index e0eab9001..170234791 100644 --- a/apps/emqtt/src/emqtt_protocol.erl +++ b/apps/emqtt/src/emqtt_protocol.erl @@ -230,9 +230,14 @@ make_packet(Type) when Type >= ?CONNECT andalso Type =< ?DISCONNECT -> #mqtt_packet{ header = #mqtt_packet_header { type = Type } }. make_packet(PubAck, PacketId) when PubAck >= ?PUBACK andalso PubAck =< ?PUBCOMP -> - #mqtt_packet { header = #mqtt_packet_header { type = PubAck}, + #mqtt_packet { header = #mqtt_packet_header { type = PubAck, qos = puback_qos(PubAck) }, variable = #mqtt_packet_puback { packet_id = PacketId}}. +puback_qos(?PUBACK) -> ?QOS_0; +puback_qos(?PUBREC) -> ?QOS_0; +puback_qos(?PUBREL) -> ?QOS_1; +puback_qos(?PUBCOMP) -> ?QOS_0; + -spec send_message(Message, State) -> {ok, NewState} when Message :: mqtt_message(), State :: proto_state(),