From Browser to Server: Data Journey

Photo by Richy Great on Unsplash

From Browser to Server: Data Journey

·

5 min read

Have you ever wondered what happens when you type a link into your website and press ‘Enter’? Obviously, you'll end up on the webpage, but that's not what I’m talking about – the behind-the-scenes process. From your browser to a server and back, several key processes happen in just a few seconds.

In this blog we will study how data travels between the browser and the server in detail. Along the way, we’ll break down the Internet…concepts and processes that make all of this possible.

Request-Response Model

Analogy : Server is big storage room or a library that holds lots of information, files, or resources. The Client is the person who goes the the library (Server) and lends a book/information/files.

What do we infer from here?

  1. Server is the destination from which a client collects data.

  2. Client is the something that asks the server to lend/send data, similar to how a person would go to a library and ask to borrow a book or get information.

  3. The client has to go the server to collect the data , just like a person must visit the library to get a book or information.

Similar to real life , we request someone when we need to ask something. In return we get a response to that request .In web contexts , the client is typically the web browser from which we search or try to get information from. There are standardized HTTP request types and response codes used for communication between clients and servers.

HTTP METHODSRESPONSE CODE
GET: Retrieve data.200: Success.
POST: Send data.301: Moved permanently.
DELETE: Remove data.404: Not found.
PUT: Update data.500: Server error.

How Data is Transmitted Over the Internet

Before we dive in , lets clarify something .The name or link you typed in the Browser?

This is called the URL(Uniform Resource Locator) . It point’s towards the address to the server so that the client can send request and accept responses.

  • The domain is human readable / easy to remember address of the website you want to visit (like example.com). It points to the server where the information is stored .

  • The path specifies the exact page or file you’re looking for on that website (like /home or /about). It helps the server know exactly what you want to see.

**Note :**The client doesn't directly go to the domain name address because the domain name is just a human-readable label for an Internet Protocol address.(machine understandable address) The internet works using IP addresses (like 192.0.2.1) . So how IP address is found?

DNS Resolution (Domain Name System)

Analogy: Asking for Directions to a Friend's House

Imagine you're trying to visit a friend’s house (the website), but you only know your friend's name (domain name), not the address (IP address). You would ideally ask a local friend and this would happen.

In the context of DNS .when your client want’s the IP address it refers to the DNS resolver as a query containing the ‘domain’ name.

  • You: A web browser or application making a DNS query.

  • Your Friend: The local DNS resolver or cache on your device.

  • He Remembers: The resolver has the IP address cached.

  • Checks If He Remembers: The resolver looks up the IP address in its cache.

  • Asks the Neighborhood: The resolver queries a local DNS server (like your ISP's DNS server).

  • Gets the Exact Address: The local DNS server resolves the domain name to an IP address.

  • Asks in the Area: The local DNS server queries a root DNS server or a TLD (Top-Level Domain) server (like .com, .org, etc.).

  • He Remembers for Next Time: The resolver caches the IP address for future lookups.

Now there is a catch here . You have to determine the best path to reach to your friend’s location (Ip address) . This is where routing comes into play.

Routing

The primary function of a router is indeed to find the best path for data to travel across networks from its source to its destination.

Analogy : Now since you have got the friend’s location .But you still don’t know the best path to travel to reach over there .There could be multiple roads to reach their house, and some might be faster or more direct than others. You ask some local friend.

  • While this friend may not know the best route, they can point you toward another friend (another router) who has more knowledge of the area.

  • Each subsequent friend (router) you meet along the way continues to provide better directions, guiding you step-by-step toward your destination.

  • Eventually, after passing through several friends (routers), you reach the correct path and finally arrive at your friend's house (the destination server).

Spider Man Pointing, Man Pointing, Spiderman Meme, Spiderman 4, You Meme, Meme Template, Marvel Characters, Reaction Pictures, Mood Pics

HTTP PROTOCOL

Analogy: Now you have reached your friend’s house . You now have to start a communication to collect what you wanted to and go back to your house .

Remember the URL?

  1. Path: The path is like giving your friend the purpose of your visit, so they know where to direct you. It ensures the server knows which specific page or resource you're requesting.

  2. Browser Info: Like sharing details about your yourself and journey, so that your friend can understand you more.

  3. Cookies: Like a friend remembering your preferences, cookies store past visits and data for a personalized experience.

  4. Date-Time: Like mentioning when you left home, helping your friend give you the latest updates.

    Finally when the information is collection , the data is sent back to the Client In form of a response.

Winding up

In short the the data flows something like this

.
Absolutely, it's truly fascinating how all these complex processes happen in the blink of an eye! From the moment you click on a link to the instant the webpage opens, data travels across networks, gets processed, and securely reaches you often within microseconds.

Thankyou!!