raatmarien / playcardswith.me

Play cards with your friends online
https://playcardswith.me
MIT License
8 stars 1 forks source link

Prevent user leaves #156

Open raatmarien opened 4 years ago

raatmarien commented 4 years ago

Right now a user can leave in a number of ways: they can close the window, refresh the window or just disconnect because of connection issues. In all cases they loose their hand right now, which is annoying. Maybe we could keep their hand for them in case of connection issues? With a cookie or something like that? And when they try to refresh or leave, display a warning like @sambeard suggested in #136?

jchmrt commented 4 years ago

My new PR #158 uses the colyseus API to allow reconnections within 20 seconds, keeping their hand. Which partly solves this.

sambeard commented 4 years ago

Perhaps store client id in persistent browser storage? The user and hand remains on server when the client didn't use the protocol to disconnect (disconnect, forced closure of browser etc) To allow multiple rooms to be joined the client id should be paired with the room id.