Common API

This document describes HBMQTT common API both used by MQTTClient API and Broker API reference.

Reference

ApplicationMessage

class hbmqtt.session.ApplicationMessage(packet_id, topic, qos, data, retain)[source]

ApplicationMessage and subclasses are used to store published message information flow. These objects can contain different information depending on the way they were created (incoming or outgoing) and the quality of service used between peers.

build_publish_packet(dup=False)[source]
Build hbmqtt.mqtt.publish.PublishPacket from attributes
Parameters:dup – force dup flag
Returns:hbmqtt.mqtt.publish.PublishPacket built from ApplicationMessage instance attributes
data

Publish message payload data

packet_id

Publish message packet identifier

puback_packet

hbmqtt.mqtt.puback.PubackPacket instance corresponding to the PUBACK packet in the messages flow. None if QoS != QOS_1 or if the PUBACK packet has not already been received or sent.

pubcomp_packet

hbmqtt.mqtt.puback.PubrelPacket instance corresponding to the PUBCOMP packet in the messages flow. None if QoS != QOS_2 or if the PUBCOMP packet has not already been received or sent.

publish_packet

hbmqtt.mqtt.publish.PublishPacket instance corresponding to the PUBLISH packet in the messages flow. None if the PUBLISH packet has not already been received or sent.

pubrec_packet

hbmqtt.mqtt.puback.PubrecPacket instance corresponding to the PUBREC packet in the messages flow. None if QoS != QOS_2 or if the PUBREC packet has not already been received or sent.

pubrel_packet

hbmqtt.mqtt.puback.PubrelPacket instance corresponding to the PUBREL packet in the messages flow. None if QoS != QOS_2 or if the PUBREL packet has not already been received or sent.

qos

Publish message Quality of Service

retain

Publish message retain flag

topic

Publish message topic

class hbmqtt.session.IncomingApplicationMessage(packet_id, topic, qos, data, retain)[source]

Bases: hbmqtt.session.ApplicationMessage

Incoming ApplicationMessage.

class hbmqtt.session.OutgoingApplicationMessage(packet_id, topic, qos, data, retain)[source]

Bases: hbmqtt.session.ApplicationMessage

Outgoing ApplicationMessage.