Long Polling and Short Polling (original) (raw)

Last Updated : 5 May, 2026

Polling is a technique where a client repeatedly sends requests to a server at fixed intervals to check for new data. It is widely used to simulate real-time updates when instant communication is not strictly required. Although it is not truly real-time, polling is simple to implement and works reliably in many applications.

**Example: A news app refreshing every 10 seconds to fetch the latest headlines from the server.

Short Polling

Short polling is a technique where the client continuously sends requests to the server at fixed intervals. The server immediately responds—either with data if available or an empty response if not. This cycle keeps repeating, allowing the client to check for updates regularly.

**Example: A chat application that sends a request to the server every 5 seconds to check for new messages, even if no new messages have arrived.

420851525

Implementation Example

In this example, we took the server file as _data.json which contains some data.

HTML `

Short Polling using AJAX