reconnect method does not seem to work - seat reservation expired error

Hello there,

I am trying to implement reconnection if say a mobile device goes to sleep and can reconnect before 60 seconds is up. Here is example of the server code:

async onLeave(client: Client, consented: boolean = false) {
"=========PLAYER LEFT THE GAME - BEFORE session connect: ",
// flag player as disconnected
this.state.players[client.sessionId].connected = false;
"=========PLAYER LEFT THE GAME - after session connect: ",
try {
if (consented) {
throw new Error("consented leave");
// wait for his reconnection (20 seconds)
await this.allowReconnection(client, 60);
console.log("=====PLAYER IS BACK!!!!!! ", client.sessionId);
// player is back!
this.state.players[client.sessionId].connected = true;
} catch (e) {
console.log("client left game on bad term: " + client.sessionId);

But I always seem to get an error even if I get a console log the player is back first: (my console logs)

=====PLAYER IS BACK!!!!!! 1F79r2PHc
Error: seat reservation expired.

I am using colyseus version 0.11. The strange thing is the server knows a player reconnected and the client says joined successfully after reconnect method. It just shows that the seat reservation expired on client side & server side.

I think I saw exactly the same bug being described previously in this forum, @endel.


I even upgraded to latest 0.13 version but still get issues

I do know the await reconnection function does fire but something after that blows up.
I am using pm2 with a reverse proxy by the way & over SSL