Is there any way to detect and handle the "out of sockets" error?
If you have a number of events that can trigger HTTP requests, it's easy to end up with enough happening in succession (if a few events happen at about the same time) that you run out of sockets (or that seems to be the case? It just happened to me when I made a few requests in rapid succession, and I don't think I was doing anything that would break it...). Is there a way to catch and handle this (ie, by waiting a few minutes and retrying)? Or is there a way to check how many free sockets there are?
Otherwise, it will be very hard to implement my current project, because it can generate http requests in response to a fairly wide variety of events, and it is very likely that these will sometimes happen in rapid succession (for example, when I open my door, I normally close it within a few seconds, since I have the A/C on...), and I don't want to have it missing events....
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.
Is there any way to detect and handle the "out of sockets" error?
If you have a number of events that can trigger HTTP requests, it's easy to end up with enough happening in succession (if a few events happen at about the same time) that you run out of sockets (or that seems to be the case? It just happened to me when I made a few requests in rapid succession, and I don't think I was doing anything that would break it...). Is there a way to catch and handle this (ie, by waiting a few minutes and retrying)? Or is there a way to check how many free sockets there are?
Otherwise, it will be very hard to implement my current project, because it can generate http requests in response to a fairly wide variety of events, and it is very likely that these will sometimes happen in rapid succession (for example, when I open my door, I normally close it within a few seconds, since I have the A/C on...), and I don't want to have it missing events....