Open dcs3spp opened 4 years ago
Oo, that's a tricky one. Usually what I do in situations like that is do a Promise.race
which throws an error after a delay to timeout a connection.
I'd be down to review a PR that adds a maxRetries
field or something similar if you're interested in taking a crack at it.
Is there any update on this? Will this feature we implemented in the future versions?
@shivamydv I'm still down to review/merge a PR if you'd like to take a shot at implementing this functionality. 😁
Hi,
The following code below permanently blocks when using connectAsync and the MQTT server is not running.
The catch handler is not being triggered. How do I correctly use
connectAsync
so that after a connect timeout period an error is caught and notified to the user??I am calling connectAsync with the following arguments:
Edit: Ahhh just looked at the source code. If I include an additional argument
allowRetries
to false then the catch handler triggers. So, if theallowRetries
argument is not included then the default behaviour is that the client will continuously try to connect and code will block permanently until it is reconnected? Is my understanding correct?Is there any option to specify the number of retries before a connection is deemed to have failed?