#Detecting opponent has returned - after reconnect

2 messages · Page 1 of 1 (latest)

graceful ridge
#

I've run into a couple race conditions around disconnection & reconnection that seems to leave API clients lost about the state of the opponent's presence.

To test these, you'll need to ability to temporarily disconnect an API-client while independently disconnecting and reconnecting a web-client. For this, I used an eBoard as my API-client, and chrome as my API-client. I connected the eBoard through a mobile hotspot on my phone so that I could turn it off and on quickly without restarting my router.

Steps to reproduce strangeness(1): no opponentGone:false after API-client reconnect:

  1. Start a game with API-client , and web-client
  2. during gameplay, close web-client
  3. wait for API-client to indicate opponentGone:true
  4. disconnect API-client by turning off hotspot
  5. while API-client is disconnected, reopen lichess.org game tab in web-client
  6. API-client reconnects to nginx, opens event-stream and receives gameStart, opens game-stream and receives gameState
  7. I cannot seem to tell if web-client is online or not

Steps to reproduce strangeness(2): no opponentGone:false after web-client returns after disconnecting while API-client not connected:

  1. Start a game with API-client , and web-client
  2. during gameplay, close web-client
  3. wait for API-client to indicate opponentGone:true
  4. disconnect API-client by turning off hotspot
  5. API-client reconnects to nginx, opens event-stream and receives gameStart, opens game-stream and receives gameState and receives opponentGone:true
  6. open lichess.org tab to reconnect web-client
  7. API-client stops receiving opponentGone:true, but does not recieve opponentGone:false. API player cannot claim victory after the timeout.

Please also see closely related question: https://discord.com/channels/280713822073913354/1437538233616437424

Maybe there's a simple rule to follow regarding opponent presence detection using a combination of event packets? But it's not immediately clear to me.

graceful ridge