Meteor Persistent Session

screenshot of Meteor Persistent Session

Modifies Meteor's Session to store variables in the browser's `localStorage`

Overview

The persistent-session package for Meteor provides a solution to an age-old problem: session persistence across page refreshes. Out of the box, Meteor's Session object clears its values every time the page is refreshed, which can be frustrating for developers looking to provide a seamless user experience. The persistent-session package leverages the amplify.js store library to save session values in the browser's localStorage, ensuring that your application's state remains intact even after reloads.

Although the package is no longer actively supported, it offers a straightforward way to manage session data for Meteor applications, making it a useful tool for developers who need to maintain session values without the hassle of continually resetting them.

Features

  • Enhanced Session Management: Keeps session values persistent across page refreshes by storing them in localStorage.
  • Default Behavior Change: New installations will have Session.set defaulting to temporary; persistent behavior can be configured.
  • Multiple Session Types: Supports temporary, persistent, and authenticated session variables to match various storage needs.
  • Bulk Setting Values: Allows setting multiple session variables at once using an object, simplifying the management of sessions.
  • Flexible Update Options: Easily update existing session variables or create temporary ones if they don't exist.
  • Default Setting Functions: Ensures session variables are only created if they do not already exist, preventing overwrites.
  • Type Conversion Commands: Change the type of a session variable with ease with dedicated commands for temporary, persistent, and authenticated types.
  • Comprehensive Clearing: Offers a clear function to remove all session variables, ensuring a clean slate when needed.