boardgameio / boardgame.io

State Management and Multiplayer Networking for Turn-Based Games
https://boardgame.io
MIT License
10.02k stars 707 forks source link

Issue in syncing with server #1001

Open Satya5614 opened 3 years ago

Satya5614 commented 3 years ago

I am trying to create a multiplayer game with 3 players, game creation and joining works fine but when i am displaying game board I just get connecting... in 10% of cases rest 90% of times it gets connected and everything works fine and refreshing the browser also don't solve the problem. Only option is to create new game

I have noticed some other users also face the same issue #713 but it is marked as closed and fixed. I am using different browsers for 3 different players and it shows

Game = Client({ matchID: gameID, debug: false, game: GameConfig, board: Board, numPlayers: numPlayers, multiplayer: SocketIO({ server: BASE_URL }), });

delucis commented 3 years ago

Thanks for the report @Satya5614! Strange that it’s a small proportion of cases and refreshing doesn’t help. Would you be able to share some more details of your setup (maybe the logic creating and joining the match and passing its ID to the client for example)? It sounds like a failure to connect successfully to the socket server although I’m not sure why.

Satya5614 commented 3 years ago

@delucis, Thanks for quick respoonse. I am creating and joining match using /create and /join rest API's, once a match is created and all 3 players joined I am redirecting to a new URL "/play/:matchID" and passing this matchID to render client

Game = Client({ matchID: matchID, debug: false, game: GameConfig, board: Board, numPlayers: numPlayers, multiplayer: SocketIO({ server: BASE_URL })

I am rendering the client as below

<Game playerID={playerID} matchID={matchID} credentials={playerCredentials} numPlayers={numPlayers}

delucis commented 3 years ago

That sounds OK in principle 🙂

When you run into this problem, do all three players have the issue or just one of them?

Can you access your server logs? Or check the database? For a match ID that has this error can you see if match state is created as expected? Or see any error logs that might suggest what’s up?

Similarly in the browser, if you open the browser console, do you see any error logging from the client that’s failing to connect?

liorp commented 3 years ago

Can confirm I have this issue too. When running locally everything works, but when deployed to Heroku the web socket does not sync for the first player but only for the second player, and it just sends 6.