server.onunexpecteddisconnect() callback reason not always so

The documentation for server.onunexpecteddisconnect() is a little misleading.

I've been overhauling my wifi code in light so some better understanding of device to agent connectivity. I monitor the reasons for disconnections and it is handy to get a reason returned when server.connect() fails or when an unsolicited disconnection occurs.

I was reviewing an agent upgrade from earlier today and could see my devices reported it as a loss of connection due to wifi trouble (1) or inability to get a IP address (2). Neither of these was actually the reason, as it was server related. My guess is that the impOS detects loss of connection swiftly, then tries to re-establish the connection. Any subsequent failure is reported as the reason. The device doesn't actually know why the original connection was lost. Any reason value passed to the callback has to be taken with a grain of salt.
Sign In or Register to comment.