Depending on the upload library you’re using you could detect when connection 
failure occurs (assuming we’re talking about a TCP stream like HTTP upload or 
similar) if the underlying socket exceptions are being exposed, you could 
handle them by triggering some form of network testing loop. This would be an 
asynchronous function that does testing of connectivity to the upload endpoint, 
and falls in to a setTimout or similar if the connection fails and then repeats 
the whole proces again. In this asynchronous function your continuation would 
be the upload function which you would call after the connection test succeeds.

This is a totally-off-the-top-of-my-head solution and I believe there has to be 
at least one if not many non modules out there that implements exactly this 
functionality I described. Hopefully someone else will respond to this with one 
of those modules as a suggestion, or maybe you’ll be able to find it yourself 
before resorting to attempting to roll your own... it’s a common pattern when 
dealing with network operations.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/a29a233f-1323-46f3-b3e8-f10c99273444%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to