Why server can’t push data with http?

Tarun Jain
2 min readFeb 29, 2024

Follow this link for all System design articles

HTTP, or Hypertext Transfer Protocol, is a central component of data communication on the World Wide Web, operating as a request-response protocol in the client-server computing model.

In this model, a client, which is typically a web browser, initiates a connection by sending a request to a server for specific resources. These resources could range from HTML pages, images, to other types of data. The server then processes this request and sends back an appropriate response containing the requested resources.

However, an important aspect of HTTP is that it is a stateless protocol. This means each individual request-response pair is treated independently, without any relation to previous or subsequent pairs. The server doesn’t maintain any information about the client between requests. This stateless nature of HTTP is what makes it impossible for the server to initiate a request, or push data to the client on its own. Without a specific request from the client, the server wouldn’t know when or what data to send.

This limitation of HTTP is a significant issue for real-time applications, where it might be necessary for the server to send updates to the client instantly, without waiting for a client request. To overcome this limitation, various other technologies have been developed.

WebSockets, for example, allow for full-duplex communication channels over a single TCP connection. This means that both the client and the server can send data to each other independently, without requiring a request from the other party.

Server Sent Events (SSE), on the other hand, is a technology that enables a server to send real-time updates to clients, using standard HTTP connections. This is especially useful for applications that require real-time data updates, such as live news updates, or social media feeds.

Another solution is HTTP/2 push, a feature introduced in the HTTP/2 protocol. With HTTP/2 push, the server can send resources to the client proactively, without waiting for the client to request each resource individually.

So, while HTTP may not natively support server push, these other technologies offer ways to achieve similar functionality, enhancing the capabilities of web communication.

--

--