<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Harshita Vaghela</title>
    <description>The latest articles on Forem by Harshita Vaghela (@harshitathat).</description>
    <link>https://forem.com/harshitathat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3760051%2F5aadbce4-59ac-4682-bf63-ac16d7cd18a3.jpeg</url>
      <title>Forem: Harshita Vaghela</title>
      <link>https://forem.com/harshitathat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/harshitathat"/>
    <language>en</language>
    <item>
      <title>How Browsers Actually Talk to Servers (No BS Guide)</title>
      <dc:creator>Harshita Vaghela</dc:creator>
      <pubDate>Sun, 08 Feb 2026 13:51:41 +0000</pubDate>
      <link>https://forem.com/harshitathat/how-browsers-actually-talk-to-servers-no-bs-guide-1f1h</link>
      <guid>https://forem.com/harshitathat/how-browsers-actually-talk-to-servers-no-bs-guide-1f1h</guid>
      <description>&lt;p&gt;I used the web for years without really understanding it.&lt;/p&gt;

&lt;p&gt;I could build apps.&lt;br&gt;
I could ship features.&lt;br&gt;
But if someone asked “what actually happens when you type a URL and hit enter?” — I’d give a half-correct answer and hope the conversation moved on.&lt;/p&gt;

&lt;p&gt;This post is the explanation I wish I had earlier.&lt;br&gt;
No history lesson. No protocol trivia. Just how browsers and servers actually talk.&lt;/p&gt;

&lt;p&gt;We usually say:&lt;/p&gt;

&lt;p&gt;“The browser sends a request. The server sends a response.”&lt;/p&gt;

&lt;p&gt;That’s not wrong.&lt;br&gt;
It’s just useless.&lt;/p&gt;

&lt;p&gt;Real systems break when you don’t understand what’s in between.&lt;/p&gt;

&lt;p&gt;Step 1: the browser doesn’t know your server&lt;/p&gt;

&lt;p&gt;When you type:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://collabspace.app" rel="noopener noreferrer"&gt;https://collabspace.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your browser has no idea where that server lives.&lt;/p&gt;

&lt;p&gt;So it asks DNS:&lt;/p&gt;

&lt;p&gt;“Hey, what IP address owns collabspace.app?”&lt;/p&gt;

&lt;p&gt;DNS responds with something like:&lt;/p&gt;

&lt;p&gt;203.0.113.42&lt;/p&gt;

&lt;p&gt;That’s it.&lt;br&gt;
No magic. Just a phonebook lookup.&lt;/p&gt;

&lt;p&gt;If DNS is slow or broken, your app feels slow, even if your backend is perfect.&lt;/p&gt;

&lt;p&gt;Step 2: TCP before HTTP (this part matters)&lt;/p&gt;

&lt;p&gt;Before any HTTP request exists, the browser does this:&lt;/p&gt;

&lt;p&gt;opens a TCP connection to 203.0.113.42&lt;/p&gt;

&lt;p&gt;negotiates encryption (TLS) if it’s HTTPS&lt;/p&gt;

&lt;p&gt;This handshake costs time.&lt;/p&gt;

&lt;p&gt;That’s why:&lt;/p&gt;

&lt;p&gt;cold starts feel slow&lt;/p&gt;

&lt;p&gt;HTTP/2 and HTTP/3 exist&lt;/p&gt;

&lt;p&gt;connection reuse matters more than people think&lt;/p&gt;

&lt;p&gt;You can’t optimize what you don’t know exists.&lt;/p&gt;

&lt;p&gt;Step 3: HTTP is just text (mostly)&lt;/p&gt;

&lt;p&gt;A request looks like this:&lt;/p&gt;

&lt;p&gt;GET /api/documents/123 HTTP/1.1&lt;br&gt;
Host: collabspace.app&lt;br&gt;
Authorization: Bearer token&lt;/p&gt;

&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;No functions.&lt;br&gt;
No objects.&lt;br&gt;
Just structured text over a connection.&lt;/p&gt;

&lt;p&gt;Frameworks hide this, but bugs leak through when headers, methods, or status codes are wrong.&lt;/p&gt;

&lt;p&gt;Step 4: your backend is not “the server”&lt;/p&gt;

&lt;p&gt;The request doesn’t magically hit your Next.js route.&lt;/p&gt;

&lt;p&gt;It goes through layers:&lt;/p&gt;

&lt;p&gt;load balancer&lt;/p&gt;

&lt;p&gt;reverse proxy (nginx / vercel edge)&lt;/p&gt;

&lt;p&gt;app server&lt;/p&gt;

&lt;p&gt;middleware&lt;/p&gt;

&lt;p&gt;route handler&lt;/p&gt;

&lt;p&gt;database / cache&lt;/p&gt;

&lt;p&gt;When something breaks, it’s usually not your code.&lt;br&gt;
It’s one of the layers you forgot existed.&lt;/p&gt;

&lt;p&gt;Step 5: stateless by default (yes, really)&lt;/p&gt;

&lt;p&gt;Each HTTP request is independent.&lt;/p&gt;

&lt;p&gt;The server does not remember the user.&lt;/p&gt;

&lt;p&gt;So we fake memory using:&lt;/p&gt;

&lt;p&gt;cookies&lt;/p&gt;

&lt;p&gt;headers&lt;/p&gt;

&lt;p&gt;tokens&lt;/p&gt;

&lt;p&gt;sessions&lt;/p&gt;

&lt;p&gt;Redis&lt;/p&gt;

&lt;p&gt;If you ever wondered why auth is annoying — this is why.&lt;/p&gt;

&lt;p&gt;The web was never designed for “logged-in users”.&lt;br&gt;
We hacked that in later.&lt;/p&gt;

&lt;p&gt;Step 6: responses are just decisions&lt;/p&gt;

&lt;p&gt;A response is simply:&lt;/p&gt;

&lt;p&gt;status code&lt;/p&gt;

&lt;p&gt;headers&lt;/p&gt;

&lt;p&gt;body&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;200 OK&lt;br&gt;
Content-Type: application/json&lt;/p&gt;

&lt;p&gt;Status codes aren’t decoration.&lt;/p&gt;

&lt;p&gt;If you misuse them:&lt;/p&gt;

&lt;p&gt;caching breaks&lt;/p&gt;

&lt;p&gt;retries break&lt;/p&gt;

&lt;p&gt;clients behave weirdly&lt;/p&gt;

&lt;p&gt;Most “random frontend bugs” are actually bad backend responses.&lt;/p&gt;

&lt;p&gt;Where WebSockets change the game&lt;/p&gt;

&lt;p&gt;HTTP is request → response → done.&lt;/p&gt;

&lt;p&gt;Real-time apps don’t fit that model.&lt;/p&gt;

&lt;p&gt;So WebSockets do this instead:&lt;/p&gt;

&lt;p&gt;open one connection&lt;/p&gt;

&lt;p&gt;keep it alive&lt;/p&gt;

&lt;p&gt;send messages both ways&lt;/p&gt;

&lt;p&gt;That’s how collaborative apps, chats, and multiplayer tools work.&lt;/p&gt;

&lt;p&gt;Not “real-time APIs”.&lt;br&gt;
Just persistent connections.&lt;/p&gt;

&lt;p&gt;Once you get this, WebSockets stop feeling scary.&lt;/p&gt;

&lt;p&gt;Why this matters if you’re “full-stack”&lt;/p&gt;

&lt;p&gt;If you build full-stack apps and don’t understand this:&lt;/p&gt;

&lt;p&gt;debugging feels random&lt;/p&gt;

&lt;p&gt;performance feels mystical&lt;/p&gt;

&lt;p&gt;system design feels abstract&lt;/p&gt;

&lt;p&gt;Once you do:&lt;/p&gt;

&lt;p&gt;logs make sense&lt;/p&gt;

&lt;p&gt;network tabs become useful&lt;/p&gt;

&lt;p&gt;architecture decisions get easier&lt;/p&gt;

&lt;p&gt;This knowledge pays off forever.&lt;/p&gt;

&lt;p&gt;My rule of thumb&lt;/p&gt;

&lt;p&gt;If you can’t explain:&lt;/p&gt;

&lt;p&gt;DNS&lt;/p&gt;

&lt;p&gt;TCP vs HTTP&lt;/p&gt;

&lt;p&gt;stateless requests&lt;/p&gt;

&lt;p&gt;persistent connections&lt;/p&gt;

&lt;p&gt;…you’re using the web, not building on it.&lt;/p&gt;

&lt;p&gt;That’s fine early on.&lt;br&gt;
But at some point, you should cross that line.&lt;/p&gt;

&lt;p&gt;Final thought&lt;/p&gt;

&lt;p&gt;Frameworks are great.&lt;br&gt;
Abstractions are useful.&lt;/p&gt;

&lt;p&gt;But the browser and server don’t care about your stack.&lt;/p&gt;

&lt;p&gt;They only care about:&lt;/p&gt;

&lt;p&gt;bytes&lt;/p&gt;

&lt;p&gt;connections&lt;/p&gt;

&lt;p&gt;rules&lt;/p&gt;

&lt;p&gt;Learn those once.&lt;br&gt;
They never change.&lt;/p&gt;

&lt;p&gt;If you liked this&lt;/p&gt;

&lt;p&gt;I’m building CollabSpace, a real-time collaborative app, and sharing everything I learn in public.&lt;/p&gt;

&lt;p&gt;Next posts coming:&lt;/p&gt;

&lt;p&gt;building a real-time collaborative app from scratch&lt;/p&gt;

&lt;p&gt;why i stopped collecting frameworks and started shipping&lt;/p&gt;

&lt;p&gt;what “full-stack engineer” actually means in 2026&lt;/p&gt;

&lt;p&gt;Follow me if you want less fluff and more real engineering.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
