In this article, we are going to look at the basics of web applications or how web applications work?
First of all, let’s understand what’s called a Web Application?
A Web Application is a piece of software which can be accessed from a browser and you know what is called a browser?
A browser is an application that you use for browsing the internet. Their examples are IE, Google Chrome, Firefox or Safari, you all know about that.
Technically speaking we can call a Web Application a web server although there is a difference in it. It is that a web server can host multiple applications but for the time being, let’s call a web application a web server.
And a web server is actually network applications on the machine, listening to a port. The browser is actually called a web client or more formally we call that a user agent and in fact web clients are not only browsers but any application which can speak the way web server like cURL, Telnet those are also web clients or user agents.
So the web client or the user agents communicate with the web server to get its job done and for this communication and actually for any communication here both the parties need to use the same set of rules which we call Protocol in technical terms.
You got what is called a Protocol?
It is simple like – when two parties are communicating for example- when two people are communicating they need to use the same language and the same set of grammar rules so that they can understand each other.
Similarly in computer science sometimes when a applications are communicating they need to use the same set of rules which we call protocol and they were also can speak sometimes standard protocols like the HTTP protocol, FTP Protocol, the web socket protocol or there are many protocols which browsers can speak and each of these protocols are suitable for different kind of tasks.
For Example, the FTP protocol is used for transferring files and among all these protocols the HTTP protocol is the most commonly used protocol with the web client and in the web server club i.e. most of the times the web client and web servers speak to one another using the HTTP protocol.
And in fact, in this whole article, we are going to focus on only that HTTP protocol.
So let’s dig more into the HTTP protocol to understand HTTP protocol, we need to let’s start with what is called a web resource or resource as commonly said.
The resource is a document like an HTML document, PDF document or a JSON document or XML file or any kind of document and which is hosted by host servers or in other words a web client can access whole documents through a web server.
The resource could be either static or dynamic. The resource which does not change is called a static resource that means it’s like some static file sitting in the web server, hard disk or somewhere to which this web server has got access to and when a request for resource comes from a wen client the web server pass that resource to the web client straight.
In contrast, a dynamic resource is generated on the fly in the sense that when a request for a dynamic resource comes from a web client the web server builds the resource on the fly.
For example: suppose a web server has a resource which embeds the current time either in some XML document or in an HTML page or whatever. So when there is a request for this particular resource comes from a web client the web server gets the current time from the system and puts that into required document i.e. in XML, HTML or any other document embedding that particular timing into it and then it sends back that document to the web client.
Each resource on the web in the world is identified by a unique URL which is actually a unique string. One way to look at that with an example- For Ex – https://hostdens.com/one-dollar-linux-web-hosting.php of a URL which is points to a unique resource in the world and this part of the URL i.e. HTTP is a protocol and other parts i.e. domain name identifies the web servers in the world and remaining in the path of the resource in the web server.
So HTTP protocol is basically is the request-response protocol i.e. whenever the web client needs to do some operation on a resource like reading it or updating it or deleting it or creating a new resource or any kind of operation the web client first establishes the connection with the web server where the resource is hosted and then the web client sends a request to it. The request contains the details of what the web client wants like which operations it wants and like that etc.
While the web server receives the request it responds with a “Response” back to the web client and that means it sends a “Response” back to the web client. And the contents of the response depends on the what was requested.
For Ex: – If the client wants particular resource the response will either put the resource in the response or in form the client that the resource is not available with me you go somewhere else for the resource or something like that.
And then after the response is given to the web client the connection is closed and the web server does not remember anything about the past connections and who the clients were?
That means next time if the client needs another request to the server the web server will treat that request as a new request coming from a new web client and because of this nature HTTP protocol is called as a stateless protocol and this one pair of request and response is called an HTTP transaction. So this was a basic overview of how a web server and web clients work.
Visit – Hostdens