lijim / monks-and-mages

Monks and Mages is a TCG-game built on React and socket.io
https://www.monksandmages.com
MIT License
17 stars 0 forks source link

Feat: Add persistent sessions #427

Closed lijim closed 1 year ago

lijim commented 1 year ago

Another step towards allowing users to reconnect to games. Users will now be able to refresh and see the same name as they had before, thanks to implementing some client-side persistence of socket.auth variables in local storage. Prior to this PR, we had stored them in local storage, but never used them.

In this PR:

Next up:

Example of being able to automatically log back in as an authenticated user:

https://user-images.githubusercontent.com/1839462/226113332-caeecf4a-005f-4c4c-b3b3-7b5123daac2d.mov

Logging in automatically with last session as a guest user:

https://user-images.githubusercontent.com/1839462/226113362-80400399-87cc-4fc5-bdcc-1b4333c7701c.mov