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
Reference to asyncio in synchronous method gmqtt.client.Client.publish #46
Comments
Thanks for merging, the above traceback does no longer occur now. Would appreciate a release just in case of some spare time ;-) Thank you in advance |
Thanks for notice. As I can see, you are using threads (and pypy) and we didn't tested our lib in such way of usage. May be the If you did it and the problem still happening, notify us. And thanks for your PR. 😊 |
The async_to_sync wrapper is just a workaround, because I need to call async methods from within the gmqtt callbacks. Best would be having coroutines as callbacks, that would simplify it a lot. Thank you all for acting so fast. |
Hi, We support an async callback only for Also you always can add coroutine to event loop from sync method in this way: async def example(*args, **kwargs):
# do async stuff
pass
def on_message(*args, **kwargs):
asyncio.ensure_future(example(*args, **kwargs) |
Aha, I see now: Lines 296 to 299 in d198e5b
Very good solution, to be able to use sync and async according to the needs. |
Good point, will try this. |
There is a wrong line in the publish() method of the client:
gmqtt/gmqtt/client.py
Line 195 in c167583
which causes failures in my code:
Since this line has no effect it should be removed from this synchronous function.
The text was updated successfully, but these errors were encountered: