After waiting 10 minutes for an opponent, I opened a second tab and played against myself. Until your application becomes immensely popular, and this issue goes away, it would be nice to have an estimate of wait time.
Just keep track of recent "new opponent" events (keeping times of the most recent 10 events is sufficient) such as new visitor arriving, game ending, or server starting up (the last one just handles the edge case when you are the first player to load the application). Time elapsed since the earliest event (including only the 10 most recent events) divided by the number of events (again, this is at most 10) yields a reasonable estimate of wait time.
After waiting 10 minutes for an opponent, I opened a second tab and played against myself. Until your application becomes immensely popular, and this issue goes away, it would be nice to have an estimate of wait time.
Just keep track of recent "new opponent" events (keeping times of the most recent 10 events is sufficient) such as new visitor arriving, game ending, or server starting up (the last one just handles the edge case when you are the first player to load the application). Time elapsed since the earliest event (including only the 10 most recent events) divided by the number of events (again, this is at most 10) yields a reasonable estimate of wait time.
Alternatively, you could pair someone with a computer player if they've been waiting for more than a minute. https://github.com/ericlavigne/tic-tac-toe/blob/master/src/t...