INNER CODE UNIT · Python
subscribe
sabuhish/fastapi-mqtt · fastapi_mqtt/fastmqtt.py:244
def subscribe(
self,
*topics,
qos: int = 0,
no_local: bool = False,
retain_as_published: bool = False,
retain_handling_options: int = 0,
subscription_identifier: Any = None,
) -> Callable[..., Any]:
"""
Decorator method used to subscribe for specific topics.
"""
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(