I am trying to pass a connectTimout for a specific time 10 secs, but connect Timeout still take default 30 secs.
mqtt.connect('mqtts://192.168.0.0', {
connectTimeout: 10000,
})
Above code should timeout after 10 secs if wrong endpoint is passed, but it is not working as expected.
use client offline to use connectTimeout.
client.on("offline",function(){
client.end();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.