Session
A session is a temporary interaction between a client and a server. It enables state management, often using session cookies or tokens to track user activity.
Also known as: User session, server session.
Comparisons
- Cookie vs. Session: Cookies are stored on the client-side, while session data is often stored on the server.
- Stateless vs. Stateful: HTTP is stateless; sessions introduce state for continuous interactions.
Pros
- Simplifies user experiences: Maintains state across multiple requests.
- Enhances security: Sensitive data is stored on the server rather than the client.
Cons
- Expiration: Sessions typically expire after a defined period of inactivity.
- Server load: Active sessions consume server resources.
Example
A session keeps a user logged in while navigating a web application.