What is long polling?

 Posted by Rajnilari2015 on 9/19/2015 | Category: HTML 5 Interview questions | Views: 2285 | Points: 40

In the case of long polling, the client sends request to the server.If the server has some information to send back to the client at that point of time, it will.Else,the server will keep the connection open but will not respond back to the client until the time it has the data.However, the client will make a poll to the server after a certain period of time to check for the availability of the data.Once the server has further data, it will send the response back to the client.As soon as the client receives the response back from the server, it again make a new request and the process goes on.

Step 1: Client send request to server
Step 2: Server checks if it has data to respond back or not
Step 3: If Server has data, it will give a response back to the client
Step 4: If not, it(Server) will keep the connection open.
Step 5: Client makes a further call to the server after a specified time interval.
Step 6: Repeat Step 2 to Step 4.
Step 7: Once Server has the data, it responded back to the client.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response