Merge pull request #185 from thecodingmachine/fixreconnect

Fixing reconnect issue
This commit is contained in:
David Négrier 2020-06-17 16:16:51 +02:00 committed by GitHub
commit a6bda673ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -325,6 +325,7 @@ export class Connection implements ConnectionInterface {
});
this.getSocket().on(EventMessage.RECONNECT, () => {
console.log('Reconnect event triggered');
this.connectSocketServer();
if (this.lastPositionShared === null) {
throw new Error('No last position shared found while reconnecting');

View File

@ -204,8 +204,8 @@ export class GameManager {
// Wait a bit for scene to load. Otherwise, starting ReconnectingSceneName and then starting GameScene one after the other fails for some reason.
this.timeoutCallback = setTimeout(() => {
console.log('Reconnecting to game scene from setTimeout');
this.reconnectToGameScene(lastPositionShared);
this.timeoutCallback = null;
this.reconnectToGameScene(lastPositionShared);
}, 500);
return;
}