Tutorials > The Web > How The Web Works
How The Web Works
What is the Internet?
Welcome to the first tutorial. Before we can start building on the web, we must first understand what exactly is the internet.
The internet is essentially a big infrastructure of computers across the world that are able to communicate with each other and transfer data. But how did we get here?
In order for computers to communicate they need to have a link between them, either physical (e.g Ethernet) or wireless (e.g Wi-Fi, Bluetooth, etc). Before the days of the internet, this would have typically been a series of network cables between computers which would establish a small local network. Think a local library that needs to transfer files from the users' computers to the librarian's computer to print like the figure below.
Then we developed the router, a small computer for "routing" other computer communications between each other. Routers meant that computers can connect to and send their communications to a centralised computer rather than each other. It would then act as a traffic controller to relay a communication to the target computer, making the network more efficient. Think, if you have 10 computers in a network, connecting each to 1 router is more efficient than connecting each to 9 other computers if need be.
Ok so we can have lots of these small computer networks with a router around the place but how do we connect these networks together?
Since routers are also computers, we could connect two routers together to join networks together. But typically this is where an Internet Service Provider (ISP) comes in. An ISP manages several special routers in different locations that are all linked together and can access other ISPs' routers. Once we connect our network's router to an ISP, and other networks do the same, we can communicate with computers on those networks. In the 90s this was established in dial-up internet which used telephone lines to transfer information from network to ISP and ISP to ISP. But nowadays the standard is subterranean fibre-optic cables which allow for high-speed, low-latency internet communication across the world.
This infrastructure is essentially what the internet is.
What is The Web?
Although used interchangeably, the web and the internet are slightly different. The internet is the infrastructure that enables communication between computers. But the web is a special service built on top of the internet that uses a certain protocol where some computers (web servers) can send special kinds of data to be requested and understood by web browsers. These specials kinds of data are often webpages. Keep this distinction in your mind from now on; when I say "internet" I will refer to the physical infrastructure, when I say "web" I will refer to the service.
Anyway, other internet services like the web also exist, for example email. A computer on the internet designed to receive emails may not be able to receive data from a web server on the internet, but both the web and email are services that use internet infrastructure to facilitate their communications.
So when we access a webpage or a resource through a web browser, we are communicating with a web server and this dynamic is what forms the web.
Clients and Servers
Computers and entities that form the web follow a very basic pattern.
Firstly, you have what is known as a client. A client is something or someone that is able to request and interpret data from a web server. Typically this is a web browser on someone's personal computer (e.g Google Chrome, Microsoft Edge etc), which is specifically designed for the job and ease of use.
Secondly, you have what are known as servers or web servers. Servers are a special kind of computer (remember the internet is just computers talking to other computers). The main job of a web server is to make available, and provide the data that a client is requesting (e.g a webpage).
So when clients and servers on the web are communicating, typically a client will request some data from a web server and the web server will send the data back if it is available. This is part of what's called the request-response cycle and we will look at it more in depth in a future tutorial.
Accessing The Web
Ok so on the web we have clients and web servers, but if I'm sitting here with my web browser (client) open, how do I request data from a web server?
Well, every computer on the internet has a unique address that identifies it called an Internet Protocol address (IP Address), kind of like a house address. It is an address typically made of four numbers separated by dots, for example: "142.250.190.78". We can type these addresses into our web browser and press enter, and if the address corresponds to a web server, it may send some data back that it has for the browser to interpret. So imagine, this process is kind of like opening Google Maps and navigating to a house address we want to visit, and then knocking on the door to see who opens up.
But speaking of Google, for example, if we type the example IP address into our web browser's address bar:
The data that gets returned is Google's home webpage (at the time of writing; IP addresses can change) because that IP address corresponds to Google's web server, and they have made a homepage for themselves available on the web. Not only that, but they are able to respond to our request since we are making it through a web browser and the web browser follows protocols necessary for web communication:
Now, you might be thinking, but what about domain names? I usually type "google.com" to access Google or any other website on the web instead of these random numbers. Well, understanding the internet, the web and IP addresses is the first step to getting there. We'll look at domain names in the next tutorial.
Key Concepts Learnt
- The internet is an architecture that allows computers to communicate with each other.
- Every computer on the internet has a unique identifier called an IP address.
- The web is a service built on top of the internet that allows a web browser to request and interpret data from web servers.
- The web consists of clients (responsible for making data requests) and web servers (reponsible for responding to data requests).