If I'm understanding properly ... the callback handler on an http.get() will not be invoked if the original connection request times out. I think I am also understanding that there is no on("error") handler in the current implementation for the object returned by http.get().
If these concepts are true, then we don't have an "elegant" means of detecting that a network request through http.get() has timed out and hence have no way of "handling" such a situation.
The best notion we have right now is firing a timer to go off some time in the future when we could sensibly assume that the connection should have been made ... and in that timer function, check see if the connection did indeed happen (or assume that since the timer fired ... we weren't cancelled) ... and handle there.
I suggest that this is a great opportunity to form a group of us to determine if this is the desired final semantics we want ... and, if not ... figure out what the correct semantics should be, start a design and then make progress towards implementation. My opinion is that I really don't like the "timer" solution as a long term solution and believe that I would like the on("error") handler on the "get()" request.
© Espruino, powered by microcosm.
Report a problem