Connection Error Handling [message #1787380] |
Thu, 24 May 2018 10:24 |
Warren Boshell Messages: 1 Registered: May 2018 |
Junior Member |
|
|
Hi Eclipse
I would like to ask how I can handle connection errors within the Paho JS Module. Currently I am testing the Paho MQTT 3.1 Client and I get the following error "paho-mqtt.js:1046 WebSocket connection to 'ws://192.168.1.32:9001/mqtt' failed: Connection closed before receiving a handshake response" from within the paho-mqtt module"
This was received when an attempt was made to connect to a Broker that is not present on the network. I wanted to see how I can handle the connection in the event the Broker was removed or failed.
I do receive an response object via "onFailure" which is fine, but I also (first) get the above error, which I am not sure how to handle.
I expected the lack of a Broker on the system to give me a response object which I can handle within my code, but I was not expecting a fatal error, I thought this type of issue (missing Broker on the network or disconnection) would be handled without throwing an error.
I am sure I am missing something simple here, and would appreciate some guidance on how to make the client more robust to network issues without throwing errors.
Browser - Chrome Version 66.0.3359.181 (Official Build) (64-bit)
Test MQTT Client - 3.1
Incidentally when a Broker is present the system works as intended, I just need a way to make the client more robust on the network and handle reconnections as detailed in the documentation without throwing errors.
Kind Regards
Warren
|
|
|
Powered by
FUDForum. Page generated in 0.03316 seconds