Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to the data that my ajax requested if the browser closed and there is nothing to receive it

In my web site (vb.net / c# ) there is javascript ajax code that gets data from the database and returns JSON to my page.

What happens if just before the ajax is about to receive the JSON, the browser is closed or the page was redirected, what happens to that data as there was nothing to receive it?

I can see that because its asynchronous the vb.net carries on running and sends a response. but there was nothing to receive it - what happens to the responses.

It cant just vanish into thin air - technically what happens - will my server crash?

like image 396
Hello-World Avatar asked Nov 17 '25 14:11

Hello-World


2 Answers

They get sucked into the void, never to be seen or heard of again.

That is, your client pc will still receive the packets via TCP/IP, but the TCP/IP stack will not deliver them anywhere.

like image 189
Roy Dictus Avatar answered Nov 19 '25 05:11

Roy Dictus


Garbage collector dismantles the whole deal.

Once the HttpContext and Session end from the user closing their browser, only requests which have started will continue. They will return data like someone yelling out into the night. The next ones will more than likely be garbage collected because the Session has ended and there is no longer a need to service the thread.

like image 31
Travis J Avatar answered Nov 19 '25 05:11

Travis J



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!