Short Polling or Ajax Polling is a technique when we have the client ping the server repeatedly, say, every 500ms (or over some fixed delay). That way, you get new data every 500ms:
- client requests a webpage from a server using regular HTTP.
- The client receives the requested webpage and executes the JavaScript on the page which requests a file from the server at regular intervals (e.g. 0.5 seconds).
- The server calculates each response and sends it back, just like normal HTTP traffic.
There are a few obvious downsides to this:
- there’s a 500ms delay,
- it consumes server resources with a barrage of requests, and most requests will return empty if the data isn’t frequently updated.