Skip to content
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

can not make mqtt_client.loop() shorter as 1 sec #195

Closed
MyRaspberry opened this issue Dec 22, 2023 · 2 comments
Closed

can not make mqtt_client.loop() shorter as 1 sec #195

MyRaspberry opened this issue Dec 22, 2023 · 2 comments

Comments

@MyRaspberry
Copy link

i try:

ts=time.monotonic()
#mqtt_client.loop() # every second check if remote command comes in
mqtt_client.loop(timeout=0.01)
print(f"___ mqtt_client loop {(time.monotonic()-ts)} sec")

more see:
test GIT of mqtt pub sub REMOTE BLINKY

@vladak
Copy link
Contributor

vladak commented Jan 26, 2024

Do you explicitly set socket_timeout and recv_timeout when initializing the MQTT object ?

@vladak
Copy link
Contributor

vladak commented Jan 26, 2024

Looking into the linked code this appears to be the case. This is not going to work, you need to reduce socket timeout below the loop timeout, because default socket timeout is 1 second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants