iaurg / 42-transcendence

Soon, you will realize that you already know things that you thought you didn’t
https://www.42transcendence.me
GNU Affero General Public License v3.0
10 stars 2 forks source link

Feat/network issues #147

Closed iaurg closed 11 months ago

iaurg commented 11 months ago

Description

analisando erros de conexão e melhorando usabilidade

PDF: Think about network issues, like unexpected disconnection or lag. You have to offer the best user experience possible.

Related Issue

Related: #57

vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
42-transcendence ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 8:24pm
iaurg commented 11 months ago

@GuiMartinelli temos um socket.emit no front mandando para o "finishGame", mas pelo que vi não existe a tratativa dessa mensagem no back.

Estava pensando em usar algo parecido com ele nas partidas abandonadas ou desconectadas, sabe qual seria o melhor fluxo para isso?

Exemplo:

@SubscribeMessage('finishGame')
  socketFinishGame(client: Socket) {
    const gameId = this.finishGame(client);
    client.leave(gameId);
    // validar se o game foi realmente abandonado
    this.gameServer.to(gameId).emit('gameAbandoned', this.gamesPlaying[gameId]);
    this.logger.debug(`Client ${client.id} disconnected.`, gameId);
  }