Open Xiaohong-Deng opened 7 years ago
this feature is halted. becasue the nature of websocket is every time you send a new http request, the ws connection is terminated and a new one is built. it applies to refreshing page or redirecting to the same page. the effect is when players click "Next Round", other players will see player number -1 before +1. there are techniques to overcome this, but it requires time to learn the tricks.
Well maybe this issue can be addressed by adding a buffer. Use a method, when a player unsubscribes, call the method, the first line of the method halts the call for like 5 seconds and check how many players in the channel then update the info.
I believe there are matured ways out there to address this. But it's just my thought.
To get fancier, we can implement what Slack provides. That is a mini bar with all the role names in it and a small dot alongside each role indicating if the player is online or not.
One thing needs to be taken into account is as follows:
this post may be useful How do I tell if a user is online?
on the game page, show a list of players with their status like this guesser (online or offline or busy) judge (online or offline or busy) reader (online or offline or busy)
since the game can be played asynchronously, surely players want to know if other players are with them or not to avoid unnecessary idle time.