1. Short polling: this is a technique used by the client to fetch data from the server. In this the client first sends a request and then the server responds with the unique id for the client. after receiving the id, client uses it for futher requests. Here, when the client sends request for time taking process, the server gives a immediate response stating it takes time. then the client waits for some time and then sends the request agian to the server.
so the technique where the client waits is known as short polling
2. Long polling: this is an another technique used where when client sends a request, the server waits for a particular time and then gives the response. for a time taking process when clients sends a request the server waits for some time, even then the process is not finished it says so.then the client sends another reuest immediately and the server wait again and sends the response
so here the client doesnt wait, only the server waits.
3. Event Stream: In this technique when client sends a request the server sends the response as soon as the event occurs. So the response is sent in a continuous manner till fully completed. And during this the connections remains established between the browser and the server.
Eg: Chatgpt response: when a user gives a prompt, the response is generated line by line and it is sent as soon as generated. Only when the whole response it sent the connection is closed
Top comments (0)