New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronous handlers #61
Comments
Hi, @DurandA |
Awesome, thank you! |
@Lenka42 The error is still present when using |
Could you please share minimal peace of code with your on_message handler? |
After some investigation, the issue is due to Here is a minimal example: def on_connect(client, flags, rc, properties):
client.subscribe('#')
async def on_message(client, topic, payload, qos, properties, loop=None):
await asyncio.sleep(1, loop=loop)
return 0
async def init(loop):
mqtt_client = MQTTClient('') # anonymous
mqtt_client.on_connect = on_connect
mqtt_client.on_message = partial(on_message, loop=loop) |
@DurandA I released fix for partial coroutines, please check newest version |
Many thanks! |
Is there any plan to switch to asynchronous handlers?
I'd like to use an asynchronous function to store messages to a database using asyncio:
Indeed it is still possible to add a new task to the event loop; I just thought it would be nicer.
The text was updated successfully, but these errors were encountered: