Scenario & Problem description :
- User request file to server
- File is big so it takes time to generate
- Client side a spinner is running to show that we are making file.
- After few mintes, their proxy times out because server hasn’t respond to the query (The reason file is too big to generate)
My Understanding :
After looking deep into this situation, I have figured that client’s proxy is timing out and I have no control over it. The only thing I can do is to change the logic of client requesting and downloding a file.
Solutions that I thought about :
Solution 1 :
-
User requests file
-
Server creates a temporary file on server side, and create an http path such as
http:\www.mydomain.com\temp\download\files\12342323.pdf
-
The link gets deleivered to client faster but it remains inactive for certain duration.
-
User clicks on link once it’s activated.
Solution 2:
I havn’t much read about this, but Is it possible to create socket connection via node.js and transfer the file?
Note:
In solution 1 is top of my head, without any coffee from last 4 hours. The only thing I am stuck as in knowledge is. How am I going to detect that file is done on server side and now my ajax script can enable the link, or download it.
Please throw some new idea to handle this situation. NO DIRECT ANSWER REQUIRED. I rather know which equipment to use for fishing, then getting a fish readymade. 🙂 Cheers.
FYI : I have php and javascript as a tool to use at the moment.
If the file always gets created eventually, and the problem is on the client side, you could do the following:
Then you could setup a cron job or something like that to delete the files that have already been downloaded.