You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ! i can't find any way to execute some logic when a players leaves a match.
I'd like to handle cases where a player leave a match (by closing it's browser for example). Right now i'm using Pusher which send webhooks to my api when a user quits the application, which handle calling the lobby leave endpoint (https://boardgame.io/documentation/#/api/Lobby?id=leaving-a-match) using the appropriate player ID and player credentials.
I have a custom players state in G to handle players score, position on the board, etc...
After a player leaves the match, i'd like to remove his state and remove him from the turn order to prevent other players being blocked.
But when a player has left the match (when his "isConnected" attribute is set to false) i can't find a way to execute some logic to do that.
Should i use a server middleware on the leave route to update the game state ? and how ? Or Is there a better solution to achieve that ?
Can someone guide me into doing this ?
The text was updated successfully, but these errors were encountered:
Neodark7
changed the title
Hook when a player leaves a match
Handle GameState changes when Players leaves a match
Aug 9, 2022
Not really, for now we made a fork of the library, and we added some logic to the master onConnectionChange method to call a new flow method we created that handle game state changes when some player join or leave a match but it doesn't works really well..
I really don't understand how it's possible that such thing is not already implemented. Like nobody ever tought of handling this ? 🤷♂️ i still feel that i'm missing something here but it looks like there is no way to handle player leaving a match 🤦♂️
Hi ! i can't find any way to execute some logic when a players leaves a match.
I'd like to handle cases where a player leave a match (by closing it's browser for example). Right now i'm using Pusher which send webhooks to my api when a user quits the application, which handle calling the lobby leave endpoint (https://boardgame.io/documentation/#/api/Lobby?id=leaving-a-match) using the appropriate player ID and player credentials.
I have a custom players state in G to handle players score, position on the board, etc...
After a player leaves the match, i'd like to remove his state and remove him from the turn order to prevent other players being blocked.
But when a player has left the match (when his "isConnected" attribute is set to false) i can't find a way to execute some logic to do that.
Should i use a server middleware on the leave route to update the game state ? and how ? Or Is there a better solution to achieve that ?
Can someone guide me into doing this ?
The text was updated successfully, but these errors were encountered: