shlogg · Early preview
Vidhi-Thakur @vidhi-thakur

Real-Time Updates With WebSocket API Vs Polling In Web Development

Polling technique has drawbacks: increased network load, low latency & delayed updates. Use WebSocket API for real-time 2-way comms, reducing network load & providing instant updates.

Usually, when a client gets the data from a server, it sends a request to the server, and the server then sends the response (or requested data) back. The issue with this process is we don't get the new data on the client side as soon as the new data is available to the server. 
Now let's say we want real-time updates on our web application. How do we do that!?
First, let us understand what polling is. 

  
  
  Polling

Well, polling is a technique in which the client sends the request repeatedly to the server after a fixed interval. This way, the client can check if the server has new inform...