Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aborting an HTTP request. Server-side advantage?

Tags:

ajax

http

tcp

In, for example, JavaScript AJAX libraries it is possible to abort an AJAX request. Is there any server side advantage to this or is it just for client-side cleanliness? Is it part of TCP?

If, for example, I am requesting via AJAX a Python based server service – which is resource intensive – from my JavaScript Web App and abort this AJAX request, is it possible that aborting will ease the load on the server, or will the my ajax library just ignore the response from the server?

like image 903
Ross Avatar asked Sep 21 '11 20:09

Ross


2 Answers

It does not affect the server-side if you use your frameworks abort feature. The server will still process the request regardless.

like image 105
tmslnz Avatar answered Nov 10 '22 14:11

tmslnz


Once you made an HTTP request to a resource URL on your server (be it Asynch or not, aka ajax or "regular"), you can't abort it from your client / with another http request (unless your service has some weird listener that awaits for potential consequent http requests and stops itself up receiving one). My proposition, if you have one resource and time consuming operation, either split it into simpler operations, parallelize it or at east make some periodic responses to at least inform the user that it's still working and hasn't died

like image 43
Shivan Dragon Avatar answered Nov 10 '22 13:11

Shivan Dragon