HTTP is the most common method of data transfer in client server-based architecture. But there are two ways for data transfer: HTTP Push and HTTP Pull. Let’s understand them.
In the HTTP pull method, the client sends a request to the server and the server responds to that request (and the connection is closed). The client pulls the data from the server whenever it requires (by creating a new connection). And it keeps doing it over and over to fetch the updated data.
The most common example of this is the REST API calls or Remote Procedure Calls (RPC). In both of these methods, the first client initiates a request to a server and then server after processing the request, replies with the result to the client.
This is the default HTTP communication method and is extensively on the Internet for fetching HTTP pages from websites.
In this method, the client experience a small time delay in receiving updated content.
The disadvantage of the HTTP pull method is that if clients keep on periodically makes the pull request for updated data, but there are no updates at the server hence, every time the client will get the same result, bandwidth will be wasted and the server will be busy too.
Also, excessive pulls by the clients have the potential to bring down the server.
To overcome the problem with HTTP pull, an HTTP push was introduced. In the HTTP push method, the client opens a connection to the server by requesting a server only the first time and after that server keeps on pushing back updated content to the client, whenever there’s any.
In this method, the client receives the updated content instantly.
The HTTP push mechanism, leverage the persistent connection i.e. the connection remains constantly active for further communications instead of being closed after a single request and response, just like in HTTP pull.
Push services are often based on the information preferences of users expressed in advance. This is called a publish/subscribe model.
A client “subscribes” to various information “channels” provided by a server and whenever new content is available on any one of those channels, the server pushes that information out to the client or notifies the client.
Did, we miss something or do you want to add some other key points?🤔