Merge pull request #185 from thecodingmachine/fixreconnect
Fixing reconnect issue
This commit is contained in:
commit
a6bda673ba
@ -325,6 +325,7 @@ export class Connection implements ConnectionInterface {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.getSocket().on(EventMessage.RECONNECT, () => {
|
this.getSocket().on(EventMessage.RECONNECT, () => {
|
||||||
|
console.log('Reconnect event triggered');
|
||||||
this.connectSocketServer();
|
this.connectSocketServer();
|
||||||
if (this.lastPositionShared === null) {
|
if (this.lastPositionShared === null) {
|
||||||
throw new Error('No last position shared found while reconnecting');
|
throw new Error('No last position shared found while reconnecting');
|
||||||
|
@ -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.
|
// 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(() => {
|
this.timeoutCallback = setTimeout(() => {
|
||||||
console.log('Reconnecting to game scene from setTimeout');
|
console.log('Reconnecting to game scene from setTimeout');
|
||||||
this.reconnectToGameScene(lastPositionShared);
|
|
||||||
this.timeoutCallback = null;
|
this.timeoutCallback = null;
|
||||||
|
this.reconnectToGameScene(lastPositionShared);
|
||||||
}, 500);
|
}, 500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user