I am making POST requests to a web server via SIM800. I have a req.on('error', function(e)) in place but I find that only catches one particular error (I cant remember the code right now)
However in the SIM900 code if either the CIPSTART command fails or there is a CONNECT FAIL, even though the SIM900 code was throwing an exception and setting the socket to undefined - the http request function does not generate an error. I assume there is no mechanism to ripple those errors back through.
So for now I have implemented my own callbacks from the SIM900 code to capture those errors so I can retry. But the question is, how do I ensure the existing http request is properly killed off so I dont leak memory from retries ? Or worse the request code ends up returning something (error or not) after I have already captured an error and begun a retry.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I am making POST requests to a web server via SIM800. I have a req.on('error', function(e)) in place but I find that only catches one particular error (I cant remember the code right now)
However in the SIM900 code if either the CIPSTART command fails or there is a CONNECT FAIL, even though the SIM900 code was throwing an exception and setting the socket to undefined - the http request function does not generate an error. I assume there is no mechanism to ripple those errors back through.
So for now I have implemented my own callbacks from the SIM900 code to capture those errors so I can retry. But the question is, how do I ensure the existing http request is properly killed off so I dont leak memory from retries ? Or worse the request code ends up returning something (error or not) after I have already captured an error and begun a retry.