on_subscribed Event
Fires for each topic filter subscription the server acknowledges.
Syntax
class MQTTSubscribedEventParams(object): @property def topic_filter() -> str: ... @property def qos() -> int: ... @property def response_code() -> int: ... # In class MQTT: @property def on_subscribed() -> Callable[[MQTTSubscribedEventParams], None]: ... @on_subscribed.setter def on_subscribed(event_hook: Callable[[MQTTSubscribedEventParams], None]) -> None: ...
Remarks
This event fires each time the server has acknowledged a topic filter subscription request (that is, calling subscribe with multiple topic filters will cause this to fire multiple times).
- TopicFilter: The topic filter subscription request being acknowledged.
- QOS: The QoS level the server has granted for the subscription.
- ResponseCode: Indicates the result of the subscription request.
Possible values for ResponseCode are:
- 0: Success, QoS 0 granted
- 1: Success, QoS 1 granted
- 2: Success, QoS 2 granted
- 128: Unspecified error
- 131: Implementation specific error; The SUBSCRIBE is valid but the Server does not accept it.
- 135: Not authorized; The Client is not authorized to make this subscription.
- 143: Topic Filter invalid; The Topic Filter is correctly formed but is not allowed for this Client.
- 145: Packet Identifier in use
- 151: Quota exceeded; An implementation or administrative imposed limit has been exceeded.
- 158: Shared Subscriptions not supported
- 161: Shared Subscriptions not supported
- 162: Wildcard Subscriptions not supported
Keep in mind that the server may have chosen to grant a lower QoS than was requested under certain circumstances (e.g., if the server doesn't support the requested QoS).
Note: the server is not required to acknowledge a subscription before it begins delivering messages for that subscription.