I am logging some analytics data based on people clicking on my site. When a person clicks on something, it sends a call to my node application via an ajax call, but if what they clicked is an external link, the original request gets cancelled since they leave the site. Is there a good way for node to process the request even after the client has disconnected?
Share
It definitely wouldn’t matter if the running process does not need to write things to the response.
Even then, it probably doesn’t matter anyway if you do something like
User submits request, you respond “thanx, the job was started”. Before you respond, asynchronously execute the job (not hard given that node.js code should be asynchronous to begin with).
Job puts data in some table or file or nosql store.
User can go to a different url to see a list of jobs and their states (started, running, complete) and view results.