QMqttSubscription#
The QMqttSubscription
class receives notifications from an MQTT broker about a specified topic. More…
Synopsis#
Properties#
qos
- This property holds the QoS level at which the subscription has been madereason
- This property holds the reason string for the subscriptionreasonCode
- This property holds the reason code for the subscriptionsharedSubscription
- This property holds whether the subscription is sharedsharedSubscriptionName
- This property holds the name of the shared subscriptionstate
- This property holds the state of the subscriptiontopic
- This property holds the topic of the subscription
Functions#
def
isSharedSubscription
()def
qos
()def
reason
()def
reasonCode
()def
sharedSubscriptionName
()def
state
()def
topic
()def
userProperties
()
Slots#
def
unsubscribe
()
Signals#
def
messageReceived
(msg)def
qosChanged
(arg__1)def
stateChanged
(state)
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
- class PySide6.QtMqtt.QMqttSubscription#
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
- property PᅟySide6.QtMqtt.QMqttSubscription.qos: 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.
- Access functions:
qos
()Signal
qosChanged
(arg__1)
- property PᅟySide6.QtMqtt.QMqttSubscription.reason: 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.
- Access functions:
reason
()
- property PᅟySide6.QtMqtt.QMqttSubscription.reasonCode: 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.
- Access functions:
reasonCode
()
This property holds This property holds whether the subscription is shared..
- Access functions:
This property holds This property holds the name of the shared subscription..
- Access functions:
- property PᅟySide6.QtMqtt.QMqttSubscription.state: SubscriptionState#
This property holds This property holds the state of the subscription..
- Access functions:
state
()Signal
stateChanged
(state)
- property PᅟySide6.QtMqtt.QMqttSubscription.topic: PySide6.QtMqtt.QMqttTopicFilter#
This property holds This property holds the topic of the subscription..
- Access functions:
topic
()
- 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.
- Return type:
bool
Getter of property sharedSubscription
.
- PySide6.QtMqtt.QMqttSubscription.messageReceived(msg)#
- Parameters:
This signal is emitted when the new message msg
has been received.
- PySide6.QtMqtt.QMqttSubscription.qos()#
- Return type:
quint8
Getter of property qos
.
- PySide6.QtMqtt.QMqttSubscription.qosChanged(arg__1)#
- Parameters:
arg__1 –
quint8
Notification signal of property qos
.
- PySide6.QtMqtt.QMqttSubscription.reason()#
- Return type:
str
Getter of property reason
.
- PySide6.QtMqtt.QMqttSubscription.reasonCode()#
- Return type:
Getter of property reasonCode
.
- PySide6.QtMqtt.QMqttSubscription.sharedSubscriptionName()#
- Return type:
str
Getter of property sharedSubscriptionName
.
- PySide6.QtMqtt.QMqttSubscription.state()#
- Return type:
Getter of property state
.
- PySide6.QtMqtt.QMqttSubscription.stateChanged(state)#
- Parameters:
state –
SubscriptionState
Notification signal of property state
.
- PySide6.QtMqtt.QMqttSubscription.topic()#
- Return type:
Getter of property topic
.
- 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
.