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

The keepalive parameter doesn't seem to work #14

Open
Sunny0218 opened this issue Jan 22, 2024 · 3 comments
Open

The keepalive parameter doesn't seem to work #14

Sunny0218 opened this issue Jan 22, 2024 · 3 comments

Comments

@Sunny0218
Copy link

Hello, it's me. The client keeps on trying to reconnect for me when I set keepalive to 0. Is there a way to disable the auto-reconnect mechanism? Also, is there any way to hide the error report in the console? Looking forward to your reply.
1705912929375

@tommy44458
Copy link
Owner

Hi @Sunny0218,

I'm happy to see you! If you don't want to try reconnecting to the broker, you can register the 'on-reconnect' event to determine when to disconnect the client (if reconnecting counter > 3 then disconnect it). Additionally, error messages would not be shown in a production environment.

@Sunny0218
Copy link
Author

Hi @Sunny0218,

I'm happy to see you! If you don't want to try reconnecting to the broker, you can register the 'on-reconnect' event to determine when to disconnect the client (if reconnecting counter > 3 then disconnect it). Additionally, error messages would not be shown in a production environment.

@tommy44458 Thank you for your reply. I would like to ask one more question based on your reply: Is the reconnect mechanism disconnected by the method "mqttHook.disconnect()"?

@tommy44458
Copy link
Owner

@Sunny0218 Yes, that's right.

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