In our game, and I think this must be the case in many games, we send certain data to our API at the end of the game, but we've noticed that when players disconnect, the server closes instantly, so the requests don't have time to be sent. this may have already been integrated, but I haven't been able to find it.
Something else that might be interesting would be to make a request to cancel matchmaking.