Commit graph

19 commits

Author SHA1 Message Date
David Négrier 30a4d504e4 Refactoring connection to use async/await 2020-07-02 10:11:12 +02:00
David Négrier a5514ce78a Code cleanup and removing exception in favor of console error 2020-06-22 18:42:54 +02:00
David Négrier 3f927280a6 Lint 2020-06-22 16:11:48 +02:00
David Négrier 403ea223a8 Reconnecting also on socket error 2020-06-22 16:10:18 +02:00
David Négrier f88f28db3f Refactoring reconnection: putting it into the GameScene directly. 2020-06-22 15:00:23 +02:00
David Négrier d785a8a1bf Refactoring connection to be part of a GameScene
Most of the refactoring issues we are seeing are probably due to the fact that we are trying to manipulate a ScenePlugin out of a Scene (the GameManager is not a Scene and holds a reference to a ScenePlugin coming from a Scene that might get invalidated by Phaser 3).
Furthermore, if we want in the future to be able to scale, scenes could be hosted on different servers. Therefore, it makes no sense to have one connexion for the whole application.
Instead, we should have one connexion for each scene.
2020-06-22 11:58:07 +02:00
David Négrier e2be99490b Finishing removing any reference to "any" in the front. 2020-06-19 16:36:40 +02:00
David Négrier 8348d13bfe Fixing use const instead of let 2020-06-19 14:30:34 +02:00
David Négrier 817b25b0be Fixing reconnect issue
In the case the reconnect event was triggered on "wake-up", the disconnect event was not sent. But because of a bug in the way we handle the setTimeout, the reconnection to the GameScene never happened after we forced the disconnect scene.
This fixes the issue.
2020-06-17 16:06:02 +02:00
David Négrier b8f9e25b26
Merge pull request #184 from thecodingmachine/debugreconnect
Adding console log when trying to reconnect
2020-06-17 15:43:20 +02:00
David Négrier b14524625c Adding console log when trying to reconnect 2020-06-17 15:37:02 +02:00
David Négrier 473c5aa052 Fixing events fired multiple times
Callbacks for socket.io events were registered each time a disconnect was called, leading to message being dispatched plenty of times if there was several disconnections.
2020-06-11 13:34:25 +02:00
David Négrier 77167c28a6 Making sure that even is a user did not move, the reconnection can happen without issues and resume at the old position 2020-06-11 10:04:23 +02:00
David Négrier 96c5d92c46 Fixing disconnection taking ~15 seconds
Most of the time, sending a disconnect event to one of the players is enough (the player will close the connection
which will be shut for the other player).
However! In the rare case where the WebRTC connection is not yet established, if we close the connection on one of the player,
the other player will try connecting until a timeout happens (during this time, the circle with the name is displayed for nothing).

So now, we send disconnection event to every body (not only the people in the group, but also to the person leaving the group)
2020-06-05 13:07:18 +02:00
David Négrier 111bfcfe8c More strict typecheck fixes 2020-06-04 18:56:22 +02:00
David Négrier a231024502 Fixing strict type checks 2020-06-04 18:56:22 +02:00
David Négrier 62cb8cca87 Also removing dead class 2020-05-25 22:36:44 +02:00
David Négrier 17e7f1b37a Removing dead code from previous messaging system
Remvoing messages that were no more used in the new messaging system (the code used to handle the message that sent the position of all users on the front side)
2020-05-25 22:36:44 +02:00
David Négrier 1fa39b0781 Fixing typos.
Replaced connexion with connection and LogincScene with LoginScene
2020-05-24 23:14:12 +02:00
Renamed from front/src/Connexion.ts (Browse further)