mqtt-vue-hook icon indicating copy to clipboard operation
mqtt-vue-hook copied to clipboard

The keepalive parameter doesn't seem to work

Open Sunny0218 opened this issue 1 year ago • 3 comments

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

Sunny0218 avatar Jan 22 '24 08:01 Sunny0218

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 avatar Jan 26 '24 08:01 tommy44458

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()"?

Sunny0218 avatar Jan 26 '24 08:01 Sunny0218

@Sunny0218 Yes, that's right.

tommy44458 avatar Jan 26 '24 09:01 tommy44458