]> git.cworth.org Git - lmno-server/commit
lmno: Save session state to disk so clients can reconnect after server restart
authorCarl Worth <cworth@cworth.org>
Sun, 8 Mar 2026 23:41:22 +0000 (19:41 -0400)
committerCarl Worth <cworth@cworth.org>
Sun, 8 Mar 2026 23:41:22 +0000 (19:41 -0400)
commit824c8e36f36d5b7dbfce9b6fa1918386b7a92a36
tree505e380e9c86099473a14e9c9605a53447ff6e1e
parenta7da66a417fcca3819c86e74b01bd8b9f08729f3
lmno: Save session state to disk so clients can reconnect after server restart

In recent commits we added save/restore of all game state, but our
express session objects were only stored in memory. So, after a server
restart, a client reconnecting was getting an entirely new session
rather than being connect to an existing session (and associated with
the current player state in the game object).

To fix this, this commit adds a new FileStore in session-store.js
which saves sessions to a JSON file on disk when sessions are changed,
(basically just user login or nickname change), and loads them at
server start.
lmno.js
session-store.js [new file with mode: 0644]