3 ms·
Ask HN: Why using server session store?
HTTP is stateless, API for mobile app is stateless, so why does web application makes HTTP stateful by storing user data in its store ?
- andrewfromx 10y agoWell HTTP is stateless but in that form it isn't much fun. So to get around this years ago web apps decided to store state from one request to the next and a whole new world opened up. The whole concept of having a user being logged in or not logged in comes from this. And the whole idea of when logged in as userA you see something different than userB logged in somewhere else. You can think about it like a deli counter ticket number system. Each stateless HTTP request comes in and gets assigned a number. When that user makes their next request to the HTTP server, it sends along it's number. And this is all done behind the scenes with cookies. Your ticket number is a cookie, when you are given a cookie, u present that same cookie each time you come back. So the guy at the counter knows your ticket 45 and the other guy is ticket 98. So once you have a system where the 1st http request without a cookie gets assigned a number and every request it makes in the future will contain that number, voila, HTTP is now stateful.