-
Notifications
You must be signed in to change notification settings - Fork 20
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
Python async support #79
Comments
Async Client sounds good @mchrisgm |
Sounds interesting. Could be useful to add async support, but there will definitely be some timing concerns |
I implemented some commands manually and did not had any issues |
How do we proceed? I would do it like this
I would also try to pull out all validation logic and state into the common class wherever possible. |
Will look into it |
Anything new? |
Would still like to contribute... |
If you need async context it's probably best that you create a separate async mqtt client. Out of interest why do you need async context (if it's for webserver, we've had pretty much no issues with FastApi for example)? The general design of the Api has been to effectively try to recover the current state of the printer and then constantly update the state - when you query for the state you probably want the last recorded state rather than the next state. The place where async would perhaps be useful is verifying commands are published correctly ? If the problem is the wait time we can disable the wait_for_publish, after publishing messages. |
Hey,
very useful library.
I am very keen on using this in an async context.
aiomqtt is a async python paho mqtt client, which could be used as a base.
As a first step I think pulling out the command creation logic out of PrinterMQTTClient and make a common logic base class out of it. Then async and sync child classes could be created. This would not break any current behavior/naming.
ftp and stream similar.
For my current project, I need an async impl. Forking, or copying commands seems not very elegant to me, so I created this pr. I am also willing to contribute if you are willing to merge ;)
The text was updated successfully, but these errors were encountered: