INNER CODE UNIT · Python
subscribe_handler
sabuhish/fastapi-mqtt · fastapi_mqtt/fastmqtt.py:257
def subscribe_handler(handler: MQTTMessageHandler) -> MQTTMessageHandler:
self._logger.debug("Subscribe for topics: %s", topics)
for topic in topics:
if topic not in self.subscriptions:
subscription = Subscription(
topic,
qos,
no_local,
retain_as_published,
retain_handling_options,
subscription_identifier,
)
self.subscriptions[topic] = (subscription, [handler])
else:
# Use the most restrictive field of the same subscription
old_subscription = self.subscriptions[topic][0]
new_subscription = Subscription(
topic,