educative.io

Educative

In this technique instead of immediately returning the response, the server holds the response until it finds an update to be sent to the client

I am little confused to understand AJAX - Long Polling and Polling with AJAX apart from the fact one is Push mechanism and other is Pull mechanism.
Could you please elaborate more on this. Also, if you can give some examples where AJAX Long Polling is used.

@Aishwarya_Tiwari

From your question, I am assuming you want to dig more into the difference between Ajax Polling & Long Polling.

With regards to that -

This W3School resource is a good read on understanding how Ajax code works

To understand how long polling works? Do go through this StackOverflow thread - How Long Polling Works?

Also, read Ajax Polling Vs Long Polling

If it’s something else let me know.

I’ve also been confused here.
In my case the confusion comes from that lines from TTL:“If the client doesn’t receive a response from the server within the TTL, the browser kills the connection & the client has to re-send the request hoping it would receive the data from the server before the TTL ends this time.”
Also in HTTP-Push based technologies we have this : “These are just blank request responses between the client and the server to prevent the browser from killing the connection.”
Hence I deduce that when performing Ajax Polling no response is got within the TTL unless some data needs to be updated.
Later in Long Polling I read: “In this technique instead of immediately returning the response, the server holds the response until it finds an update to be sent to the client.” So now I feel really confused: Does Polling always gets a response or not???

Also, having a TTL does not yields a Long Polling? I see no differences there. I would appreciate an explanation on this since I think the lessons are itself a bit confusing (I am very happy with the course anyways)