Notes on the World Wide Web and the Internet

It dawned on me that while learning to program for the web, I’ve never taken a step back to actually understand some of the most fundamental concepts of the web. So I decided to fix it…by furiously googling on internets of course! 🙂 I also took some notes…

The World Wide Web is a magical place where all the interlinked web resources live. Each resource is identifiable by a Uniform Resource Locator (URL) and accessible via the Internet.

Resource – an entity that can be identified, named, addressed or handled, in any way whatsoever, on the Web.

The Internet is a network of interconnected computers that communicate using a host of protocols.

Client Server Model – is one model that dictates how computers interact with each other over the internet. Typically the client initiates the communication with a request for a resource or a service and the server provides a response. The browser is one such client that users use to communicate with a server.

IP (Internet Protocol) – is a unique address that identifies each interconnected computer in the client server model. But before the client and server exchange a request and a response, they need to establish a connection with each other in a process called Three-Way Handshake.

Three-Way Handshake – in simple terms, first the client sends a Synchronize packet to the server. The server then sends a Synchronize Acknowledgment to the client. Finally, the client sends back an Acknowledgment and the process is done. After identifying each other, the client and server can now open a socket connection between them.

Port number – is a number that identifies the specific program on the computer that is making the request/response. The client and server can now send information back and forth across the socket connection using this Port number.

Packets – the information being sent back and forth is not sent all at once. It is split into small packets of data and sent across the socket from one computer to another.

TCP ( Transmission Control Protocol ) is the protocol that specifies the way in which the splitting of the information into small packets is conducted.

HTTP is the protocol that defines how each individual packet of information transmitted over the socket should be structured.

HTTP also consists of verbs that indicate a type of action to be performed on a specific resource. Most common verbs are the GET, POST, PUT and DELETE verbs.

URL – is simply a web address that happens to point to a specific resource that lives in a network.

To sum it up, when we type in a URL and hit enter on our Internet connected browser (client), we are telling the browser that somewhere in the World Wide Web there exists a resource at this URL address, can you please GET it?

The browser then makes an HTTP request to a server. The server then responds with a resource in the form of HTML, which might prompt other requests for images and css. After it receives the response, the browser then proceeds to render the webpage.

Representational State Transfer (REST)

A set of stylistic architectural principles to guide application development.

Representation : Whenever a server responds with a requested resource, what we get back is not actually the resource object itself. Rather the server gives as the representation of the current state(data) of the resource object in a specific format, perhaps JSON. But the response could’ve also been in an HTML or an XMl format.

In a similar manner when a client makes a request. The request is a representation of the desired state of the resource. The HTTP verb included in the request tells the server the desired action to be applied to change the state of the resource (GET, PUT, DELETE…).

REST is then a set of rules on how a client and a server can transfer the state of of a resource via representation. When a user interacts with a resource like clicking a link, another request is triggered to transfer the next state of the resource.