QMqttSubscription#

The QMqttSubscription class receives notifications from an MQTT broker about a specified topic. More

Inheritance diagram of PySide6.QtMqtt.QMqttSubscription

Synopsis#

Functions#

Slots#

Signals#

Detailed Description#

class PySide6.QtMqtt.QMqttSubscription#
PySide6.QtMqtt.QMqttSubscription.SubscriptionState#

This enum type describes the states a subscription can have.

Constant

Description

QMqttSubscription.Unsubscribed

The topic has been unsubscribed from.

QMqttSubscription.SubscriptionPending

A request for a subscription has been sent, but is has not been confirmed by the broker yet.

QMqttSubscription.Subscribed

The subscription was successful and messages will be received.

QMqttSubscription.UnsubscriptionPending

A request to unsubscribe from a topic has been sent, but it has not been confirmed by the broker yet.

QMqttSubscription.Error

An error occured.

PySide6.QtMqtt.QMqttSubscription.isSharedSubscription()#
Return type

bool

This property holds This property holds whether the subscription is shared..

PySide6.QtMqtt.QMqttSubscription.messageReceived(msg)#
Parameters

msgPySide6.QtMqtt.QMqttMessage

PySide6.QtMqtt.QMqttSubscription.qos()#
Return type

quint8

This property holds This property holds the QoS level at which the subscription has been made..

The QoS level of the subscription specifies the maximum QoS level at which the client will receive messages. The publisher can still send messages at a lower level.

PySide6.QtMqtt.QMqttSubscription.qosChanged(arg__1)#
Parameters

arg__1quint8

PySide6.QtMqtt.QMqttSubscription.reason()#
Return type

str

This property holds This property holds the reason string for the subscription..

A reason string is used by the server to provide additional information about the subscription. It is optional for the server to send it.

PySide6.QtMqtt.QMqttSubscription.reasonCode()#
Return type

ReasonCode

This property holds This property holds the reason code for the subscription..

The reason code specifies the error type if a subscription has failed, or the level of QoS for success.

PySide6.QtMqtt.QMqttSubscription.sharedSubscriptionName()#
Return type

str

This property holds This property holds the name of the shared subscription..

PySide6.QtMqtt.QMqttSubscription.state()#
Return type

SubscriptionState

This property holds This property holds the state of the subscription..

PySide6.QtMqtt.QMqttSubscription.stateChanged(state)#
Parameters

stateSubscriptionState

PySide6.QtMqtt.QMqttSubscription.topic()#
Return type

PySide6.QtMqtt.QMqttTopicFilter

This property holds This property holds the topic of the subscription..

PySide6.QtMqtt.QMqttSubscription.unsubscribe()#

Unsubscribes from topic .

Note

This might affect all shared pointer instances returned by subscribe() .

PySide6.QtMqtt.QMqttSubscription.userProperties()#
Return type

QMqttUserProperties

Returns the user properties received from the broker when the subscription has been accepted.

Note

This function will only provide valid data when the client specifies MQTT_5_0 as ProtocolVersion .