Skip to main content

Command Palette

Search for a command to run...

🎫 Sessions Explained Like You're 5

Published
β€’2 min read
S

Building AI systems and writing about how they actually work. Master of AI @ University of Technology Sydney. Previously B.Tech CS with focus on IoT. I believe the best way to learn is to explain. That's why I'm documenting tech concepts with simple analogies (@sreekarreddy.com). AWS Certified β€’ Azure AI Certified β€’ Neo4j Professional β€’ Google Data Analytics When not coding: exploring Sydney, working on side projects, and teaching tech to anyone who'll listen.

A hotel room key card

Day 45 of 149

πŸ‘‰ Full deep-dive with code examples


The Hotel Key

At a hotel:

  1. You check in at the front desk
  2. They give you a key card
  3. Key card opens YOUR room, not others
  4. When you check out, key stops working

Sessions work the same way!


How It Works

  1. You log in to a website
  2. Server creates a "session" for you
  3. Gives your browser a session ID (like a key card)
  4. Session ID unlocks YOUR data on the server
Login β†’ Server creates Session #12345
     β†’ Browser stores ID: "12345"

Every request: "I'm session 12345"
Server: "Ah yes, that's Alex! Show Alex's dashboard."

Sessions vs Cookies

Cookie: Data stored in YOUR browser Session: Data stored on the SERVER, you just have the ID

Sessions can reduce exposure because sensitive data typically stays on the server (the browser usually only keeps an ID).


When Sessions End

  • You log out (check out)
  • You close the browser
  • Too much time passes (timeout)

In One Sentence

Sessions let servers remember who you are by giving your browser an ID that links to your data on the server.


πŸ”— Enjoying these? Follow for daily ELI5 explanations!

Making complex tech concepts simple, one day at a time.

More from this blog

esreekarreddy

132 posts